Inconsistent response handling in v2
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 581
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
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:
- construct
outas the concatenated data stream string - since the header
content-typedoes not includeapplication/jsonso... - the response
dataproperty is set to theout(aka the response body realized) - the promise is resolved with that response (aka
response.datais the response body XML string)
However, in the fetch version we have this flow:
- the header
content-typedoes not includeapplication/jsonso... - try to parse the string from
fetch.text()as JSON - since the response is XML this throws
- set the error on the response
- the promise is rejected but the
fetch.text()string is not available on the response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the response handling in src/node.js and src/fetch.js, starting at the linked content-type branches and fetch.text() path. Trace how non-JSON response bodies are exposed and rejected, then verify that XML responses behave consistently in both implementations and that the body remains available when appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100