Superagent: Zlib / incorrect header check in vanilla request

Created on 14 Aug 2013  路  6Comments  路  Source: visionmedia/superagent

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.

Most helpful comment

@defunctzombie i'm still seeing this. newer versions of what? superagent, zlib?

All 6 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

littlee picture littlee  路  8Comments

shreychaturvedi123 picture shreychaturvedi123  路  9Comments

mikecousins picture mikecousins  路  6Comments

jvanalst picture jvanalst  路  10Comments

srohde picture srohde  路  8Comments