Closed yigaldviri closed 2 weeks ago
Resolved per https://github.com/ladjs/superagent/pull/1812
v10.0.0 is released to npm, can you please try it out and let us know if it works OK? 🙏
Thank you for your contribution 🎉
Ref: https://github.com/ladjs/superagent/releases/tag/v10.0.0
Describe the bug
Node.js version: Node 14, 16, 18, 20
OS version: Mac Ventura 3.0.1
Description: It seems like its not possible to receive a response body when the content is compressed using Brotli compression.
Actual behavior
SyntaxError: Unexpected token in JSON at position 0
since the body isn't decompressedExpected behavior
Body decompressed from Brotli and JSON is returned
Code to reproduce
I tried this simple code:
And got
SyntaxError: Unexpected token in JSON at position 0
since the body isn't decompressedWhen I tried to manually decompress it like that:
It worked and I got the proper result:
I tried using
node-fetch
andaxios
and it worked without a need to manually intercept it and Im guessing that behind the scenes you are using Node'shttp
module that have thezlib
module that handles gzip and etc... so what am I missing here?Checklist