-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: simple code refactoring #11594
Conversation
@@ -283,7 +274,7 @@ ClientRequest.prototype._implicitHeader = function _implicitHeader() { | |||
|
|||
ClientRequest.prototype.abort = function abort() { | |||
if (!this.aborted) { | |||
process.nextTick(emitAbortNT, this); | |||
process.nextTick(emitAbortNT.bind(this)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use .bind()
in any of these cleanup PRs, we won't be able to/shouldn't backport to v6.x or v4.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I know. I'm fine with these not being backported or only being partially backported.
exports.get = function get(options, cb) { | ||
var req = exports.request(options, cb); | ||
function get(options, cb) { | ||
var req = request(options, cb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we replace var
with const
?
Ping @nodejs/http @nodejs/collaborators I will rebase this early next week and address the feedback already provided but I would appreciate a few more eyes on it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if you drop the use of bind()
, just for the sake of backporting.
How about I do a separate backport pr without bind? |
That works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it does not currently apply cleanly to master.
Some of those changes would make it harder to backport future changes from 8 to 6. I think the files read better this way, so I'm 👍 .
Yeah I'll be rebasing later on today and doing another CI run. |
New CI after rebase: https://ci.nodejs.org/job/node-test-pull-request/6941/ |
self._last = true; | ||
self.shouldKeepAlive = false; | ||
|
||
const oncreate = (err, socket) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change from function declaration to variable declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function was using a closure around self
. I modified it to use lexical this
with the arrow function.
PR-URL: #11594 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #11594 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Landed in 5425e0d...74c1e02 |
PR-URL: nodejs#11594 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#11594 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
This will need to be manually backported to v7.x |
Some simple code hygiene cleanups.
module.exports = {}
pattern,self
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http