Asking for advice from the great god, it is very strange that (zlib) reported an error when decompressing the network data requested by https.

  node.js, question

The following is my code:

var agent = https.request(option,function(res){
 var chunks = [];
 res.setEncoding('utf8');
 console.log(res.statusCode);
 res.on('data', function(chunk){
 console.log(chunk);
 chunks.push(chunk);
 });
 res.on('end',function(){
 var b = buffer.concat(chunks);
 b = zlib.gunzipSync(b);
 console.log(chunks);
 })
 });
 agent.write(param);
 agent.end();

Error reporting (partial):

zlib.js:537
 throw error;
 ^
 Error: incorrect header check
 at Zlib._handle.onerror (zlib.js:366:17)

The request returns to 200 normally. The headers of res below shows that decompression is needed, but I reported an error when decompressing. Please advise!

clipboard.png

I also met the same problem, solve ~