-
-
Notifications
You must be signed in to change notification settings - Fork 32k
http: doc deprecate abort and improve docs #32807
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
69a8af0
http: doc deprecate abort and improve docs
ronag 00f23ee
fixup: lint
ronag 083ad2e
fixup: docs
ronag 08e542a
Apply suggestions from code review
ronag 72b2694
fixup: further details
ronag ea66e37
fixup: fixes
ronag 7c636b8
Update doc/api/deprecations.md
ronag 7082213
fixup: request.destroy added v0.3.0
ronag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -568,6 +568,7 @@ server.listen(1337, '127.0.0.1', () => { | |
### `request.abort()` | ||
<!-- YAML | ||
added: v0.3.8 | ||
deprecated: REPLACEME | ||
--> | ||
|
||
Marks the request as aborting. Calling this will cause remaining data | ||
|
@@ -623,6 +624,31 @@ If `data` is specified, it is equivalent to calling | |
If `callback` is specified, it will be called when the request stream | ||
is finished. | ||
|
||
### `request.destroy([error])` | ||
<!-- YAML | ||
added: v0.3.0 | ||
--> | ||
|
||
* `error` {Error} Optional, an error to emit with `'error'` event. | ||
* Returns: {this} | ||
|
||
Destroy the request. Optionally emit an `'error'` event, | ||
and emit a `'close'` event. Calling this will cause remaining data | ||
in the response to be dropped and the socket to be destroyed. | ||
|
||
See [`writable.destroy()`][] for further details. | ||
|
||
#### `request.destroyed` | ||
<!-- YAML | ||
added: REPLACEME | ||
--> | ||
|
||
* {boolean} | ||
|
||
Is `true` after [`request.destroy()`][] has been called. | ||
|
||
See [`writable.destroyed`][] for further details. | ||
|
||
### `request.finished` | ||
<!-- YAML | ||
added: v0.0.1 | ||
|
@@ -2356,8 +2382,43 @@ the following events will be emitted in the following order: | |
* `'close'` | ||
* `'close'` on the `res` object | ||
|
||
If `req.abort()` is called before the connection succeeds, the following events | ||
will be emitted in the following order: | ||
If `req.destroy()` is called before a socket is assigned, the following | ||
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'` | ||
* `'close'` | ||
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. req.destroy() behaves different than req.abort() in this case |
||
|
||
If `req.destroy()` is called before the connection succeeds, the following | ||
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'` | ||
* `'close'` | ||
|
||
If `req.destroy()` is called after the response is received, the following | ||
events will be emitted in the following order: | ||
|
||
* `'socket'` | ||
* `'response'` | ||
* `'data'` any number of times, on the `res` object | ||
* (`req.destroy()` called here) | ||
* `'aborted'` on the `res` object | ||
* `'close'` | ||
* `'close'` on the `res` object | ||
|
||
If `req.abort()` is called before a socket is assigned, the following | ||
events will be emitted in the following order: | ||
|
||
* (`req.abort()` called here) | ||
* `'abort'` | ||
* `'close'` | ||
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 |
||
|
||
If `req.abort()` is called before the connection succeeds, the following | ||
events will be emitted in the following order: | ||
|
||
* `'socket'` | ||
* (`req.abort()` called here) | ||
|
@@ -2366,8 +2427,8 @@ will be emitted in the following order: | |
`'ECONNRESET'` | ||
* `'close'` | ||
|
||
If `req.abort()` is called after the response is received, the following events | ||
will be emitted in the following order: | ||
If `req.abort()` is called after the response is received, the following | ||
events will be emitted in the following order: | ||
himself65 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* `'socket'` | ||
* `'response'` | ||
|
@@ -2412,6 +2473,7 @@ not abort the request or do anything besides add a `'timeout'` event. | |
[`new URL()`]: url.html#url_constructor_new_url_input_base | ||
[`removeHeader(name)`]: #http_request_removeheader_name | ||
[`request.end()`]: #http_request_end_data_encoding_callback | ||
[`request.destroy()`]: #http_request_destroy_error | ||
[`request.flushHeaders()`]: #http_request_flushheaders | ||
[`request.getHeader()`]: #http_request_getheader_name | ||
[`request.setHeader()`]: #http_request_setheader_name_value | ||
|
@@ -2441,5 +2503,7 @@ not abort the request or do anything besides add a `'timeout'` event. | |
[`socket.unref()`]: net.html#net_socket_unref | ||
[`url.parse()`]: url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost | ||
[`HPE_HEADER_OVERFLOW`]: errors.html#errors_hpe_header_overflow | ||
[`writable.destroy()`]: stream.html#stream_writable_destroy_error | ||
[`writable.destroyed`]: stream.html#stream_writable_destroyed | ||
[`writable.cork()`]: stream.html#stream_writable_cork | ||
[`writable.uncork()`]: stream.html#stream_writable_uncork |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.