-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: clarify http error events after calling destroy() #46903
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -3652,7 +3652,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 | ||||||||
|
||||||||
|
@@ -3661,7 +3661,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 | ||||||||
|
@@ -3670,7 +3670,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 | ||||||||
|
@@ -3681,8 +3681,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 | ||||||||
|
||||||||
|
@@ -3720,9 +3720,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'` | ||||||||
Comment on lines
+3725
to
+3726
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This parallels the wording in the bullet points above and makes it clear that the argument is an Error and not a string. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds a bit reduntant to me, feel free to ignore |
||||||||
and the `cause`, if one was provided. | ||||||||
|
||||||||
## `http.validateHeaderName(name[, label])` | ||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was going for brevity. "Itself" doesn't seem to add clarity. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think its a necessary change to this pr, Id leave it as it was previously