mjackson / mjackson/http-client

response.body is Gunzip?!

Open
#55 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
503
Forks
23
PR merge metrics
No merged PRs in 30d

Description

I'm trying something quite simple:

let fetch = httpClient.createFetch(
      httpClient.base("https://steemit.com"),
      httpClient.accept('application/json'),
      httpClient.parse('json'),
      httpClient.debug()
    );

fetch(`/@iontichy.json`)
    .then((response) => {
        console.log(response.json)
    })
    .catch(console.error)

The result left me speechless. I expected response.json to be there. It was not. I checked the response for response.body and this is what I found:

Gunzip {_readableState: ,readable: true,domain: ,_events: ,_eventsCount: 7,...}

This is clearly a bug, yes? How do I get my data out of this Gunzip thing?!

Contributor guide

Open the contributing guide

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

Reproduce the request shown against https://steemit.com and inspect how the fetch response exposes response.body and parsed JSON. Trace the response handling from the createFetch call, then verify that the returned response provides usable JSON data instead of an unexpected Gunzip stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.