Skip to content

Commit

Permalink
http: remove unnecessary bind
Browse files Browse the repository at this point in the history
process.nextTick accepts additional parameters which
are passed through to the callback. Use that instead
of binding the function to a context.

PR-URL: #28131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
apapirovski authored and BethGriggs committed Feb 6, 2020
1 parent 1c2d699 commit 8111d69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/_http_client.js
Expand Up @@ -322,7 +322,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;

Expand All @@ -340,8 +340,8 @@ ClientRequest.prototype.abort = function abort() {
};


function emitAbortNT() {
this.emit('abort');
function emitAbortNT(req) {
req.emit('abort');
}

function ondrain() {
Expand Down

0 comments on commit 8111d69

Please sign in to comment.