Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at IncomingMessage.onclose (internal/streams/end-of-stream.js:75:15)
at IncomingMessage.emit (events.js:315:20)
at Socket.socketCloseListener (_http_client.js:383:11)
at Socket.emit (events.js:327:22)
at TCP.<anonymous> (net.js:674:12) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
When using
get-stream
to get data from a http response and the request associated with it is aborted an error is not thrown:Using
stream.finished
it properly throws:But using
getStream
it finishes successfully.I have setup an repo reproducing this behavior https://github.com/tiagonapoli/get-stream-test
Further info: Node version: 12.18.0 get-stream version: 5.1.0