From 36b4ddd38253e4dbb36c5fea24bae03dadf9df53 Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 11 Dec 2020 20:12:58 +0100 Subject: [PATCH] http: use standard args order in IncomingMEssage onError PR-URL: https://github.com/nodejs/node/pull/33035 Refs: https://github.com/nodejs/node/issues/30625 Reviewed-By: Robert Nagy Reviewed-By: Matteo Collina Reviewed-By: Rich Trott --- lib/_http_incoming.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 5442bfe7bb2479..462b08d92a828d 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -169,7 +169,7 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) { this.emit('aborted'); } - // If aborted and the underlying socket not already destroyed, + // If aborted and the underlying socket is not already destroyed, // destroy it. // We have to check if the socket is already destroyed because finished // does not call the callback when this methdod is invoked from `_http_client` @@ -178,10 +178,10 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) { this.socket.destroy(err); const cleanup = finished(this.socket, (e) => { cleanup(); - onError(this, cb, e || err); + onError(this, e || err, cb); }); } else { - onError(this, cb, err); + onError(this, err, cb); } }; @@ -361,7 +361,7 @@ IncomingMessage.prototype._dump = function _dump() { } }; -function onError(instance, cb, error) { +function onError(instance, error, cb) { // This is to keep backward compatible behavior. // An error is emitted only if there are listeners attached to // the event.