Thanks to visit codestin.com
Credit goes to github.com

Skip to content

NativeFetcher response does not match actual retuned data #2034

@FransEngstrom

Description

@FransEngstrom

Describe the Bug

The fetch method on the NativeFetcher class does not return the claimed response object:

NativeDataFetcherResponse<T> { status: number statusText: string data: T headers?: HeadersInit }
Instead it returns something like this where the request data is nested under Symbols:
{ data: { sitecore: { context: [Object], route: [Object] } }, [Symbol(state)]: { aborted: false, rangeRequested: false, timingAllowPassed: true, requestIncludesCredentials: true, type: 'default', status: 200, timingInfo: { startTime: 22155.710625, redirectStartTime: 0, redirectEndTime: 0, postRedirectStartTime: 22155.710625, finalServiceWorkerStartTime: 0, finalNetworkResponseStartTime: 22237.364583, finalNetworkRequestStartTime: 22155.976292, endTime: 0, encodedBodySize: 14558, decodedBodySize: 72786, finalConnectionTimingInfo: [Object] }, cacheState: '', statusText: 'OK', headersList: HeadersList { cookies: [Array], [Symbol(headers map)]: [Map], [Symbol(headers map sorted)]: [Array] }, urlList: [ URL {} ], body: { stream: [ReadableStream], source: null, length: null } }, [Symbol(headers)]: Headers {} }

To Reproduce

Do a request with the fetch method on the Native fetch class, look at the response.

Expected Behavior

It should return the data the interface says it will.

Possible Fix

No response

Provide environment information

  • Sitecore Version: 10.4x
  • JSS Version: 22.4.1
  • Browser Name and version: Happens serverside.
  • Operating System and version (desktop or mobile):
  • Link to your project (if available):

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogIssue/PR/discussion is reviewed and added to backlog for the further work🐞 bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions