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
When stream throws error, the event listener sends error object. The error.response.body should be decompressed when got.stream() is passed decompress: true option but actually, the response is gzip compressed if the server sends HTTPError with gzip encoding.
Second issue is that error.response.body is a buffer but ideally it should be stream.
...
Expected behavior
Response should be decompressed inside error object
The response should also be stream rather than buffer.
...
Code to reproduce
constgot=require('got');letstream=got("https://www.gumlet.com/non-exisent-path",{isStream: true,method: "GET",decompress: true,headers: {}});stream.on("response",(response)=>{console.log(response.headers);console.log(response.statusCode)});stream.on("error",(err)=>{console.log("This is compressed:",err.response.body);// this should be decompressed.console.log(Buffer.isBuffer(err.response.body));// response.body is a buffer but ideally that should also be stream.});
Checklist
I have read the documentation.
I have tried my code with the latest version of Node.js and Got.
The text was updated successfully, but these errors were encountered:
Describe the bug
Actual behavior
When stream throws error, the event listener sends
error
object. Theerror.response.body
should be decompressed whengot.stream()
is passeddecompress: true
option but actually, the response isgzip
compressed if the server sends HTTPError with gzip encoding.Second issue is that
error.response.body
is a buffer but ideally it should be stream....
Expected behavior
...
Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: