From 7a756cb53916f2f446b033c1157f0fefd31296a1 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Fri, 7 Jun 2019 22:41:33 +0200 Subject: [PATCH] http: remove unnecessary bind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit process.nextTick accepts additional parameters which are passed through to the callback. Use that instead of binding the function to a context. PR-URL: https://github.com/nodejs/node/pull/28131 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen Reviewed-By: Ruben Bridgewater --- lib/_http_client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 1d949559d96d93..f024c7fc89b150 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -327,7 +327,7 @@ ClientRequest.prototype._implicitHeader = function _implicitHeader() { ClientRequest.prototype.abort = function abort() { if (!this.aborted) { - process.nextTick(emitAbortNT.bind(this)); + process.nextTick(emitAbortNT, this); } this.aborted = true; @@ -345,8 +345,8 @@ ClientRequest.prototype.abort = function abort() { }; -function emitAbortNT() { - this.emit('abort'); +function emitAbortNT(req) { + req.emit('abort'); } function ondrain() {