Skip to content

http - http.ClientRequest doesn't emit 'aborted'? #15259

Description

@ronag

Looking through the _http_client.js code it seems to me that the http.ClientRequest object never emits an ´aborted´ event (only close). It's just the response object that emits the aborted event.

https://github.com/nodejs/node/blob/master/lib/_http_client.js#L366

That seems to go against the docs, https://nodejs.org/api/http.html#http_event_aborted

Activity

  1. changed the title [-]HTTP request 'aborted'[/-] [+]HTTP request missing 'aborted'[/+] on Sep 8, 2017
  2. changed the title [-]HTTP request missing 'aborted'[/-] [+]HTTP request missing 'aborted' event[/+] on Sep 8, 2017
  3. changed the title [-]HTTP request missing 'aborted' event[/-] [+] http.ClientRequest doesn't emit 'aborted'?[/+] on Sep 8, 2017
  4. added
    docIssues and PRs related to Node.js documentation.
    good first issueIssues that are suitable for first-time contributors.
    on Sep 8, 2017
  5. bnoordhuis commented on Sep 8, 2017

    @bnoordhuis
    Member

    Yes, it's incorrect. It may have been copy/pasted from http.IncomingMessage, which does emit it.

  6. changed the title [-] http.ClientRequest doesn't emit 'aborted'?[/-] [+]http - http.ClientRequest doesn't emit 'aborted'?[/+] on Sep 8, 2017
  7. odeke-em commented on Sep 11, 2017

    @odeke-em

    For posterity @ronag I am pasting in the permalink of the line that you referenced in code

    req.res.emit('aborted');
    so that when the code is shuffled around, we can always refer to it.

    Also this issue precedes and seems like it is related to #15283, should we be folding #15283 in here?

  8. lpinca commented on Sep 19, 2017

    @lpinca
    Member

    The documentation for this event should be moved to http.ServerResponse.

    Edit: nvm.

  9. added a commit that references this issue on Sep 19, 2017
  10. added a commit that references this issue on Sep 25, 2017
  11. added a commit that references this issue on Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions