lukeed / lukeed/httpie

Inconsistent response handling in v2

Open
#40 1 comment 0 reactions 0 assignees View on GitHub

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:

  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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.