We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 484dd53 commit 79376fdCopy full SHA for 79376fd
request.js
@@ -1070,6 +1070,14 @@ Request.prototype.onRequestResponse = function (response) {
1070
self.emit('end', chunk)
1071
})
1072
responseContent.on('error', function (error) {
1073
+ if (error.code === 'ECONNRESET' && error.message === 'aborted' && self.listenerCount('error') === 0) {
1074
+ // Node 16 causes aborts to emit errors if there is an error listener.
1075
+ // Without this short-circuit, it will cause unhandled exceptions since
1076
+ // there is not always an `error` listener on `self`, but there will
1077
+ // always be an `error` listener on `responseContent`.
1078
+ // @see https://github.com/nodejs/node/pull/33172
1079
+ return
1080
+ }
1081
self.emit('error', error)
1082
1083
responseContent.on('close', function () { self.emit('close') })
0 commit comments