Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2114fa4

Browse filesBrowse files
zbjornsondanielleadams
authored andcommitted
doc: clarify http error events after calling destroy()
PR-URL: #46903 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 1061e17 commit 2114fa4
Copy full SHA for 2114fa4

File tree

Expand file treeCollapse file tree

1 file changed

+9
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-7
lines changed
Open diff view settings
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+9-7Lines changed: 9 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -3606,7 +3606,7 @@ the following events will be emitted in the following order:
36063606
* (connection closed here)
36073607
* `'aborted'` on the `res` object
36083608
* `'error'` on the `res` object with an error with message
3609-
`'Error: aborted'` and code `'ECONNRESET'`.
3609+
`'Error: aborted'` and code `'ECONNRESET'`
36103610
* `'close'`
36113611
* `'close'` on the `res` object
36123612

@@ -3615,7 +3615,7 @@ events will be emitted in the following order:
36153615

36163616
* (`req.destroy()` called here)
36173617
* `'error'` with an error with message `'Error: socket hang up'` and code
3618-
`'ECONNRESET'`
3618+
`'ECONNRESET'`, or the error with which `req.destroy()` was called
36193619
* `'close'`
36203620

36213621
If `req.destroy()` is called before the connection succeeds, the following
@@ -3624,7 +3624,7 @@ events will be emitted in the following order:
36243624
* `'socket'`
36253625
* (`req.destroy()` called here)
36263626
* `'error'` with an error with message `'Error: socket hang up'` and code
3627-
`'ECONNRESET'`
3627+
`'ECONNRESET'`, or the error with which `req.destroy()` was called
36283628
* `'close'`
36293629

36303630
If `req.destroy()` is called after the response is received, the following
@@ -3635,8 +3635,8 @@ events will be emitted in the following order:
36353635
* `'data'` any number of times, on the `res` object
36363636
* (`req.destroy()` called here)
36373637
* `'aborted'` on the `res` object
3638-
* `'error'` on the `res` object with an error with message
3639-
`'Error: aborted'` and code `'ECONNRESET'`.
3638+
* `'error'` on the `res` object with an error with message `'Error: aborted'`
3639+
and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
36403640
* `'close'`
36413641
* `'close'` on the `res` object
36423642

@@ -3674,9 +3674,11 @@ events will be emitted in the following order:
36743674
Setting the `timeout` option or using the `setTimeout()` function will
36753675
not abort the request or do anything besides add a `'timeout'` event.
36763676

3677-
Passing an `AbortSignal` and then calling `abort` on the corresponding
3677+
Passing an `AbortSignal` and then calling `abort()` on the corresponding
36783678
`AbortController` will behave the same way as calling `.destroy()` on the
3679-
request itself.
3679+
request. Specifically, the `'error'` event will be emitted with an error with
3680+
the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`
3681+
and the `cause`, if one was provided.
36803682

36813683
## `http.validateHeaderName(name[, label])`
36823684

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.