Skip to content

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