fetch raw bytes without decompressing (and sending accept-encoding)
See original GitHub issueThis 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:
- Created a year ago
- Comments:11 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
Then I think it’s out of scope. Maybe open an issue in WinterCG to see if there is appetite for standardizing this feature.