Skip to content
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

http: deprecate aborted property and event #33345

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2668,6 +2668,39 @@ Type: Documentation-only

Use [`request.destroy()`][] instead of [`request.abort()`][].

<a id="DEP0XXX"></a>
### DEP0XX: Use `request.destroyed` instead of `request.aborted`
<!-- YAML
changes:
- version:
- REPLACEME
pr-url: https://github.com/nodejs/node/pull/33345
description: Documentation-only deprecation.
-->

Type: Documentation-only

Use [`request.destroyed`][] and [`request.readableEnded`][] instead of
[`request.aborted`][].

```js
const aborted = request.destroyed && !request.readableEnded
```

<a id="DEP0XXX"></a>
### DEP0XX: Use `'error'` event instead of `'aborted'`
<!-- YAML
changes:
- version:
- REPLACEME
pr-url: https://github.com/nodejs/node/pull/33345
description: Documentation-only deprecation.
-->

Type: Documentation-only

Use `'error'` event instead of `'aborted'`.

[`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`--throw-deprecation`]: cli.html#cli_throw_deprecation
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
Expand Down Expand Up @@ -2729,10 +2762,13 @@ Use [`request.destroy()`][] instead of [`request.abort()`][].
[`punycode`]: punycode.html
[`require.extensions`]: modules.html#modules_require_extensions
[`require.main`]: modules.html#modules_accessing_the_main_module
[`request.aborted`]: http.html#http_request_aborted
[`request.abort()`]: http.html#http_request_abort
[`request.socket`]: http.html#http_request_socket
[`request.connection`]: http.html#http_request_connection
[`request.destroyed`]: http.html#http_request_destroyed
[`request.destroy()`]: http.html#http_request_destroy_error
[`request.readableEnded`]: http.html#http_request_readableended
[`response.socket`]: http.html#http_response_socket
[`response.connection`]: http.html#http_response_connection
[`response.end()`]: http.html#http_response_end_data_encoding_callback
Expand Down
17 changes: 17 additions & 0 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,13 @@ changes:
- version: v11.0.0
pr-url: https://github.com/nodejs/node/pull/20230
description: The `aborted` property is no longer a timestamp number.
deprecated:
- REPLACEME
-->

> Stability: 0 - Deprecated: Use [`request.destroyed`][] and
[`request.readableEnded`][] instead.

* {boolean}

The `request.aborted` property will be `true` if the request has
Expand Down Expand Up @@ -1799,8 +1804,13 @@ status, headers and data.
### Event: `'aborted'`
<!-- YAML
added: v0.3.8
changes:
deprecated:
- REPLACEME
-->

> Stability: 0 - Deprecated: Use the `'error'` event instead.

Emitted when the request has been aborted.

### Event: `'close'`
Expand All @@ -1813,10 +1823,15 @@ Indicates that the underlying connection was closed.
### `message.aborted`
<!-- YAML
added: v10.1.0
deprecated:
- REPLACEME
-->

* {boolean}

> Stability: 0 - Deprecated: Use [`message.destroyed`][] and
[`message.readableEnded`][] instead.

The `message.aborted` property will be `true` if the request has
been aborted.

Expand Down Expand Up @@ -2588,10 +2603,12 @@ try {
[`removeHeader(name)`]: #http_request_removeheader_name
[`request.end()`]: #http_request_end_data_encoding_callback
[`request.destroy()`]: #http_request_destroy_error
[`request.destroyed`]: #http_request_destroyed
[`request.flushHeaders()`]: #http_request_flushheaders
[`request.getHeader()`]: #http_request_getheader_name
[`request.setHeader()`]: #http_request_setheader_name_value
[`request.setTimeout()`]: #http_request_settimeout_timeout_callback
[`request.readableEnded`]: #http_request_readableended
[`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed
[`request.socket`]: #http_request_socket
[`request.writableFinished`]: #http_request_writablefinished
Expand Down