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 MylesBorins committed Dec 17, 2019
1 parent 1722280 commit 7a756cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -345,8 +345,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 7a756cb

Please sign in to comment.