question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetch raw bytes without decompressing (and sending accept-encoding)

See original GitHub issue

This would solve…

Something that node-fetch have had is the possibility to avoid decompressing the body while also sending out accept-encoding. why would this be useful? if you make a request to abc.com on the behalf of a client (like in a proxy) and it respond with a content-length and a content-encoding then you wish to simply just send back all this response headers and pipe the data to back the client. but content-length will be a missmatch b/c the content-length will match the compressed size and what you are actually piping back to the client will be the uncompressed size

The implementation should look like…

I have also considered…

Additional context

node-fetch has compress: true but if i could rename it, then it would be decompressResponseBody: boolean and default that to true

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mcollinacommented, Aug 18, 2022

@vlovich @jasnell my understanding is that you are asking for undici fetch to support cache-control: no-transform to avoid automatically decompressing the body. This behavior is currently present in browsers. If my assessment is correct, then could you send a PR implementing this?

This issue was about adding a custom, non-spec option for doing the same client side. I’d prefer we do not add any non-spec compliant option without passing through WinterCG.

1reaction
mcollinacommented, May 21, 2022

Then I think it’s out of scope. Maybe open an issue in WinterCG to see if there is appetite for standardizing this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there any way to get curl to decompress a response without ...
Probably the easiest thing to do is just use gunzip to do it: curl -sH 'Accept-encoding: gzip' http://example.com/ | gunzip -.
Read more >
Accept-Encoding - HTTP - MDN Web Docs
The Accept-Encoding request HTTP header indicates the content encoding (usually a compression algorithm) that the client can understand.
Read more >
Encoding your HTTP for fun and profit
For example, you might have a response that contains JSON data, encoded with ... is very widely used to send data without specifying...
Read more >
Response compression in ASP.NET Core | Microsoft Learn
Don't compress files smaller than about 150-1000 bytes, ... Submit a request to the sample app without the Accept-Encoding header and ...
Read more >
HttpWebRequest and GZip Http Responses - Rick Strahl
Response; string AcceptEncoding = HttpContext. ... to retrieve HTTP Content as a string with /// optional POST data and GZip encoding.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found