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 targos committed Jan 14, 2020
1 parent 9b730ad commit baece55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/_http_client.js
Expand Up @@ -313,7 +313,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 @@ -331,8 +331,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 baece55

Please sign in to comment.