Uh oh!
There was an error while loading. Please reload this page.
http: http client response should always emit close when finished - #17397
http: http client response should always emit close when finished#17397ronag wants to merge 1 commit into
Conversation
maclover7
commented
Nov 30, 2017
@ronag Would you be able to look at the test coverage for this code and make sure it properly covers this behavior, or else would you be able to add new tests? |
addaleax
commented
Nov 30, 2017
@nodejs/http |
ronag
commented
Nov 30, 2017
@maclover7: Sorry, not sure how to build a test for this case. The tests are still a bit over my head. |
BridgeAR
commented
Dec 12, 2017
@nodejs/http @nodejs/testing anyone to provide some quick help? |
There was a problem hiding this comment.
Since you're here: this.emit('close') - saves a closure over res.
There was a problem hiding this comment.
Since res.readable == false, does that mean an 'end' event has already been emitted?
There was a problem hiding this comment.
end will never be called if not readable at this point.
@ronag about writing a test: The tests here work the same as if you would write code for your own project. So what you want to do is to write some code that would actually fail without this change. I guess you should know how to get there as you found out that it does not always emit a close when finishing. The only difference here is that you have to include the "common" part as first require statement as done in every test file in the test folder. You probably want to add a new file in the "parallel" part. In addition to that you have some extra helper functions that you find in the common part and that also has a individual documentation. But you should probably not need that at all. To run the tests you first have to build the node executable (I guess you use a unix system, so run I hope that helps? :-) |
apapirovski
commented
Feb 6, 2018
In addition to @BridgeAR's excellent guide, you could also take inspiration from the test here https://github.com/nodejs/node/blob/master/test/parallel/test-http-client-close-event.js and create a new one that hits the code path that you've modified. |
BridgeAR
commented
Feb 16, 2018
@ronag would you mind taking another look? :-) |
ronag
commented
Feb 17, 2018
Sorry guys... I’m swamped... feel free to take over |
BridgeAR
commented
Feb 17, 2018
@ronag too bad. And as a note: we are not all guys. @apapirovski@jasnell would either of you be willing to write a test for this? |
jasnell
commented
Feb 17, 2018
@ronag ... This isn't the place for that debate. |
BridgeAR
commented
Mar 2, 2018
@nodejs/http @nodejs/http2 would someone be so kind and write a small test case for this? |
trivikr
commented
Mar 2, 2018
BridgeAR
commented
Mar 2, 2018
@trivikr thanks a lot! :-) And yes, in this case I recommend to cherry-pick this commit and then add your changes and open a new PR for it. |
BridgeAR
commented
Apr 10, 2018
@trivikr do you still want to follow up on this? :-) |
trivikr
commented
Apr 10, 2018
@BridgeAR The code is lying in my private branch since last month, let me add the tests and post a PR :-) |
trivikr
commented
Apr 15, 2018
Closing this in favor of new PR #20043 |
fixes#17352
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
http