mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
http: allow url and options to be passed to http*.request and http*.get
Fixes: https://github.com/nodejs/node/issues/20795 PR-URL: https://github.com/nodejs/node/pull/21616 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
19bc893c75
commit
f9b739ebbc
5 files changed
+79
-19
No files matched your search
+12
-2
@@ -112,14 +112,19 @@ https.createServer(options, (req, res) => {
|
||||
```
|
||||
|
||||
## https.get(options[, callback])
|
||||
## https.get(url[, options][, callback])
|
||||
<!-- YAML
|
||||
added: v0.3.6
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/21616
|
||||
description: allow both url and options to be passed to `https.get()`
|
||||
- version: v7.5.0
|
||||
pr-url: https://github.com/nodejs/node/pull/10638
|
||||
description: The `options` parameter can be a WHATWG `URL` object.
|
||||
-->
|
||||
- `options` {Object | string | URL} Accepts the same `options` as
|
||||
- `url` {string | URL}
|
||||
- `options` {Object} Accepts the same `options` as
|
||||
[`https.request()`][], with the `method` always set to `GET`.
|
||||
- `callback` {Function}
|
||||
|
||||
@@ -155,9 +160,13 @@ added: v0.5.9
|
||||
Global instance of [`https.Agent`][] for all HTTPS client requests.
|
||||
|
||||
## https.request(options[, callback])
|
||||
## https.request(url[, options][, callback])
|
||||
<!-- YAML
|
||||
added: v0.3.6
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/21616
|
||||
description: allow both url and options to be passed to `https.request()`
|
||||
- version: v9.3.0
|
||||
pr-url: https://github.com/nodejs/node/pull/14903
|
||||
description: The `options` parameter can now include `clientCertEngine`.
|
||||
@@ -165,7 +174,8 @@ changes:
|
||||
pr-url: https://github.com/nodejs/node/pull/10638
|
||||
description: The `options` parameter can be a WHATWG `URL` object.
|
||||
-->
|
||||
- `options` {Object | string | URL} Accepts all `options` from
|
||||
- `url` {string | URL}
|
||||
- `options` {Object} Accepts all `options` from
|
||||
[`http.request()`][], with some differences in default values:
|
||||
- `protocol` **Default:** `'https:'`
|
||||
- `port` **Default:** `443`
|
||||
|
||||
Reference in new issue
Block a user