summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBenjamin Gruenbaum <benjamingr@gmail.com>2020-11-09 12:51:14 +0200
committerNode.js GitHub Bot <github-bot@iojs.org>2020-11-19 14:32:44 +0000
commit2097ffd7cb590d4df7f1c30eef4de18037320b7c (patch)
treec4732de2c23352ad6d11ffb9a999adf5e1e3fe41 /doc
parenta46b21f556a83e43965897088778ddc7d46019ae (diff)
downloadnode-new-2097ffd7cb590d4df7f1c30eef4de18037320b7c.tar.gz
http: add support for abortsignal to http.request
PR-URL: https://github.com/nodejs/node/pull/36048 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/http.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md
index 5b19255b57..248e4468e0 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -2336,6 +2336,9 @@ This can be overridden for servers and client requests by passing the
<!-- YAML
added: v0.3.6
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/36048
+ description: It is possible to abort a request with an AbortSignal.
- version:
- v13.8.0
- v12.15.0
@@ -2403,6 +2406,8 @@ changes:
or `port` is specified, those specify a TCP Socket).
* `timeout` {number}: A number specifying the socket timeout in milliseconds.
This will set the timeout before the socket is connected.
+ * `signal` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
+ request.
* `callback` {Function}
* Returns: {http.ClientRequest}
@@ -2596,6 +2601,10 @@ 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
+`AbortController` will behave the same way as calling `.destroy()` on the
+request itself.
+
## `http.validateHeaderName(name)`
<!-- YAML
added: v14.3.0