diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 47b2a5526dcf88..5aad4f8ff39205 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2699,6 +2699,27 @@ resolutions not in `node_modules`. This means there will not be deprecation warnings for `"exports"` in dependencies. With `--pending-deprecation`, a runtime warning results no matter where the `"exports"` usage occurs. + +### DEP0XXX: `.aborted` property and `'abort'`, `'aborted'` event in `http` + + +Type: Documentation-only + +Move to {Stream} API instead, as the [`http.ClientRequest`][], +[`http.ServerResponse`][], and [`http.IncomingMessage`][] are all stream-based. +Check `stream.destroyed` instead of the `.aborted` property, and listen for +`'close'` instead of `'abort'`, `'aborted'` event. + +The `.aborted` property and `'abort'` event is only useful for detecting +`.abort()` calls. For closing a request early, use the Stream +`.destroy([error])` then check the `.destroyed` property and `'close'` event +should have the same effect. + [Legacy URL API]: url.md#url_legacy_url_api [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 @@ -2753,6 +2774,9 @@ runtime warning results no matter where the `"exports"` usage occurs. [`fs.read()`]: fs.md#fs_fs_read_fd_buffer_offset_length_position_callback [`fs.readSync()`]: fs.md#fs_fs_readsync_fd_buffer_offset_length_position [`fs.stat()`]: fs.md#fs_fs_stat_path_options_callback +[`http.ClientRequest`]: #http_class_http_clientrequest +[`http.IncomingMessage`]: #http_class_http_incomingmessage +[`http.ServerResponse`]: #http_class_http_serverresponse [`http.get()`]: http.md#http_http_get_options_callback [`http.request()`]: http.md#http_http_request_options_callback [`https.get()`]: https.md#https_https_get_options_callback diff --git a/doc/api/http.md b/doc/api/http.md index ad34b6e1e7df40..2015f420612d84 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -396,8 +396,11 @@ body which has been transmitted are equal or not. ### Event: `'abort'` +> Stability: 0 - Deprecated. Listen for the `'close'` event instead. + Emitted when the request has been aborted by the client. This event is only emitted on the first call to `abort()`. @@ -553,7 +556,7 @@ added: v0.7.8 --> Emitted when the underlying socket times out from inactivity. This only notifies -that the socket has been idle. The request must be aborted manually. +that the socket has been idle. The request must be destroyed manually. See also: [`request.setTimeout()`][]. @@ -634,12 +637,15 @@ in the response to be dropped and the socket to be destroyed. ### `request.aborted` +> Stability: 0 - Deprecated. Check [`request.destroyed`][] instead. + * {boolean} The `request.aborted` property will be `true` if the request has @@ -1923,8 +1929,11 @@ status, headers and data. ### Event: `'aborted'` +> Stability: 0 - Deprecated. Listen for `'close'` event instead. + Emitted when the request has been aborted. ### Event: `'close'` @@ -1937,8 +1946,11 @@ Indicates that the underlying connection was closed. ### `message.aborted` +> Stability: 0 - Deprecated. Check `message.destroyed` from {stream.Readable}. + * {boolean} The `message.aborted` property will be `true` if the request has @@ -2733,6 +2745,7 @@ 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