My request looks like this:
var req = request
.get("https://apis.live.net/v5.0/me/contacts")
.query({
"access_token": accessToken
}).end(function() { });
Seems to be enough to give this error:
Error: incorrect header check
at Zlib._binding.onerror (zlib.js:295:17)
When I build the URL myself with a valid access token and point my browser to it, the request succeeds.
In browser response headers indicate encoding is deflate. When I add this to my request:
.set({"Accept-Encoding" : "gzip,sdch"})
Request succeeds. So problem seems to be in unencoding deflate-encoded streams. (I guess.)
@djechlin hmm we actually have accept-encoding by default: https://github.com/visionmedia/superagent/blob/master/lib/node/index.js#L584
so we must not be handling that correctly
Closing due to age. I think zlib issues have been resolved in newer versions.
@defunctzombie i'm still seeing this. newer versions of what? superagent, zlib?
Should be re-opened. I'm seeing this also. I believe there are a couple of other bugs related to zlib not working: https://github.com/visionmedia/superagent/issues/927, https://github.com/danwrong/restler/issues/96
I did notice that I had to change my headers from:
{ "Accept-Encoding": "gzip, deflate" }
to this:
{ "Accept-Encoding": "gzip" }
That seemed to fix it.
Can you provide a complete example with a publicly accessible URL that reproduces this problem?
Most helpful comment
@defunctzombie i'm still seeing this. newer versions of what? superagent, zlib?