You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to run some code whenever a http session is complete, done and nothing else will be emitted or run on any associated request, response or socket objects. And it should always be invoked regardless whether there has been an error, has a response, aborted or properly finished.
And I'd like to do this for http.ClientRequest as well as http and http2.
I thought, the close event on the request objects would do the trick. But sometimes it's not called at all, sometimes it's called but then later an error is invoked anyway or some event on the response object is invoked.
What's the practice here? Do we have any unit tests for this?
I guess this is what on-finished is for. But I'm not sure if that is for legacy reasons and whether it will work for http2 or if it's a best practise at all. It allocates some closures.
The text was updated successfully, but these errors were encountered:
mscdex
added
http
Issues or PRs related to the http subsystem.
http2
Issues or PRs related to the http2 subsystem.
question
Issues that look for answers.
labels
Sep 13, 2017
I would like to run some code whenever a http session is complete, done and nothing else will be emitted or run on any associated request, response or socket objects. And it should always be invoked regardless whether there has been an error, has a response, aborted or properly finished.
And I'd like to do this for
http.ClientRequest
as well ashttp
andhttp2
.I thought, the
close
event on the request objects would do the trick. But sometimes it's not called at all, sometimes it's called but then later anerror
is invoked anyway or some event on the response object is invoked.What's the practice here? Do we have any unit tests for this?
I guess this is what on-finished is for. But I'm not sure if that is for legacy reasons and whether it will work for
http2
or if it's a best practise at all. It allocates some closures.The text was updated successfully, but these errors were encountered: