Skip to content

Inconsistent response handling in v2 #40

@saibotsivad

Description

@saibotsivad

Consider a request to a server that successfully returns XML data (aka anything that is not JSON).

In the node version we have this flow:

  1. construct out as the concatenated data stream string
  2. since the header content-type does not include application/json so...
  3. the response data property is set to the out (aka the response body realized)
  4. the promise is resolved with that response (aka response.data is the response body XML string)

However, in the fetch version we have this flow:

  1. the header content-type does not include application/json so...
  2. try to parse the string from fetch.text() as JSON
  3. since the response is XML this throws
  4. set the error on the response
  5. the promise is rejected but the fetch.text() string is not available on the response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions