-
Notifications
You must be signed in to change notification settings - Fork 7.3k
http: add abort event request() #9278
Comments
ClientRequest will now emit an abort event the first time abort() is called. Semver: Minor Fixes: nodejs/node-v0.x-archive#9278 PR-URL: #945 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
@misterdjules I propose landing nodejs/node@2ca22aa to address this. Thoughts? |
@cjihrig and @misterdjules seems like a good addition to node |
@misterdjules if you want the back story, see hapijs/wreck#73. Basically, a library passes an instance of |
It's totally reasonable to emit an event for 'abort', though it's an API addition and therefore not something that can be included in v0.12. Looking at the change @cjihrig does it make sense in the scheme of things for |
@tjfontaine do you mean effectively adding an |
@cjihrig ya, I think my preference would be |
Why isn't this covered with an |
@michaelnisi Indeed. I had a similar concern towards the io.js issue. |
Explicitly aborting a connection is not an error. |
@cjihrig True, but it is the only decent way to signal the condition within the existing api, and it matches the 0.10 behavior. Note that this does not exclude adding an 'abort' event at a later stage. |
@kanongil ... while that would likely allow us to get this into v0.12 without introducing an api change, it seems like a short term fix. @cjihrig is right, aborting is not an error and shouldn't be treated as such. This is definitely a good change but it's something that can push to v0.13 (let's just not take a long time to get v0.13 out ;-) ...) |
I don't question adding an |
Closing as 0.13 seems unlikely to be released. |
There doesn't seem to be a good way (or at least I haven't found one) to detect when
ClientRequest.prototype.abort()
is called. There isClientRequest.prototype.aborted
, but that would require observing the object. It would be nice to have anabort
event emitted in this case.As a test case, I would like to detect the abort in the following code:
The text was updated successfully, but these errors were encountered: