mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
doc: clarify http error events after calling destroy()
PR-URL: https://github.com/nodejs/node/pull/46903 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
9374700d7a
commit
f0ade7084d
1 file changed
+9
-7
+9
-7
@@ -3654,7 +3654,7 @@ the following events will be emitted in the following order:
|
||||
* (connection closed here)
|
||||
* `'aborted'` on the `res` object
|
||||
* `'error'` on the `res` object with an error with message
|
||||
`'Error: aborted'` and code `'ECONNRESET'`.
|
||||
`'Error: aborted'` and code `'ECONNRESET'`
|
||||
* `'close'`
|
||||
* `'close'` on the `res` object
|
||||
|
||||
@@ -3663,7 +3663,7 @@ events will be emitted in the following order:
|
||||
|
||||
* (`req.destroy()` called here)
|
||||
* `'error'` with an error with message `'Error: socket hang up'` and code
|
||||
`'ECONNRESET'`
|
||||
`'ECONNRESET'`, or the error with which `req.destroy()` was called
|
||||
* `'close'`
|
||||
|
||||
If `req.destroy()` is called before the connection succeeds, the following
|
||||
@@ -3672,7 +3672,7 @@ events will be emitted in the following order:
|
||||
* `'socket'`
|
||||
* (`req.destroy()` called here)
|
||||
* `'error'` with an error with message `'Error: socket hang up'` and code
|
||||
`'ECONNRESET'`
|
||||
`'ECONNRESET'`, or the error with which `req.destroy()` was called
|
||||
* `'close'`
|
||||
|
||||
If `req.destroy()` is called after the response is received, the following
|
||||
@@ -3683,8 +3683,8 @@ events will be emitted in the following order:
|
||||
* `'data'` any number of times, on the `res` object
|
||||
* (`req.destroy()` called here)
|
||||
* `'aborted'` on the `res` object
|
||||
* `'error'` on the `res` object with an error with message
|
||||
`'Error: aborted'` and code `'ECONNRESET'`.
|
||||
* `'error'` on the `res` object with an error with message `'Error: aborted'`
|
||||
and code `'ECONNRESET'`, or the error with which `req.destroy()` was called
|
||||
* `'close'`
|
||||
* `'close'` on the `res` object
|
||||
|
||||
@@ -3722,9 +3722,11 @@ events will be emitted in the following order:
|
||||
Setting the `timeout` option or using the `setTimeout()` function will
|
||||
not abort the request or do anything besides add a `'timeout'` event.
|
||||
|
||||
Passing an `AbortSignal` and then calling `abort` on the corresponding
|
||||
Passing an `AbortSignal` and then calling `abort()` on the corresponding
|
||||
`AbortController` will behave the same way as calling `.destroy()` on the
|
||||
request itself.
|
||||
request. Specifically, the `'error'` event will be emitted with an error with
|
||||
the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`
|
||||
and the `cause`, if one was provided.
|
||||
|
||||
## `http.validateHeaderName(name[, label])`
|
||||
|
||||
|
||||
Reference in new issue
Block a user