You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using npm package 'got' to make request to some url. And get 'Error: incorrect header check'.
Becuase 'got' use this package to decompress the body, so I ask question here.
The uncompressed response body is <Buffer ab 56 4a 2d 2a 4a ce 4f 49 55 b2 32 d0 01 b1 73 8b d3 95 ac 94 f2 b3 95 6a 01>
response header: 'content-encoding': 'deflate'.
I find that I can use inflateRawSync to decompress the body. But has the same error when decompress it using inflateSync.
So what I should use? or it is the server's error.
The text was updated successfully, but these errors were encountered:
Because you are using createUnzip to decompress the deflate.
I make some test:
first:
consthttp=require('http');letserver=http.createServer((req,res)=>{res.writeHead(200,{'Content-Type': 'text/plain','content-encoding': 'deflate'});//whether using deflateRaw or deflate, the browser can decompress it successfully.res.end(zlib.deflateRawSync('abc'));})
and
console.log(zlib.unzipSync(zlib.deflateSync('abc')))// this is ok.
console.log(zlib.unzipSync(zlib.deflateRawSync('abc')))// this will throw 'Error: incorrect header check'
So using createUnzip can't handle the data that the browser can handle.
I'm using npm package 'got' to make request to some url. And get 'Error: incorrect header check'.
Becuase 'got' use this package to decompress the body, so I ask question here.
The uncompressed response body is
<Buffer ab 56 4a 2d 2a 4a ce 4f 49 55 b2 32 d0 01 b1 73 8b d3 95 ac 94 f2 b3 95 6a 01>
response header:
'content-encoding': 'deflate'
.I find that I can use
inflateRawSync
to decompress the body. But has the same error when decompress it usinginflateSync
.So what I should use? or it is the server's error.
The text was updated successfully, but these errors were encountered: