Skip to content
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

doc: fix HTTP res 'finish' description #21670

Closed
wants to merge 1 commit into from
Closed

doc: fix HTTP res 'finish' description #21670

wants to merge 1 commit into from

Conversation

tadjik1
Copy link
Contributor

@tadjik1 tadjik1 commented Jul 5, 2018

In addition to #21047, after #20611 close event will be emitted on response object after finish.

Checklist

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Jul 5, 2018
@tadjik1
Copy link
Contributor Author

tadjik1 commented Jul 5, 2018

And one thought in addition to that: before #21047 close event was the only way to handle connection terminated by client because this event was emitted only in that case.
Now code for handling these situations will look like:

res.on('close', _ => {
  if (res.finished) return;
  
  // res.finished is false, which means that connection was terminated
  // so do some cleanup
});

Probably it is worth to be mentioned somewhere in documentation.

@addaleax
Copy link
Member

addaleax commented Jul 10, 2018

Landed in f386c7e 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants