I'm making a request that looks like the following
request
.post(url)
.set('authorization', `Bearer ${token}`)
.send(data)
.end((err, res) => {
console.log(err, res);
});
The response from the server is compressed however with the response header content-encoding: deflate and throws the error
Error: incorrect header check at Zlib.zlibOnError [as onerror] (node:zlib:189:17) { errno: -3, code: 'Z_DATA_ERROR', response: null }
How would I be able to parse a compressed response here?
Superagent can not handle a response encoded with
deflate(despitedeflatebeing added toaccept-encodingby default)If I only accept
gzipresponsesIts able to decompress it, of course this only works if your endpoint supports gzip