@@ -1794,15 +1794,20 @@ The `requestListener` is a function which is automatically
17941794added to the [ ` 'request' ` ] [ ] event.
17951795
17961796## http.get(options[ , callback] )
1797+ ## http.get(url[ , options] [ , callback ] )
17971798<!-- YAML
17981799added: v0.3.6
17991800changes:
1801+ - version: REPLACEME
1802+ pr-url: https://github.com/nodejs/node/pull/21616
1803+ description: allow both url and options to be passed to `http.get()`
18001804 - version: v7.5.0
18011805 pr-url: https://github.com/nodejs/node/pull/10638
18021806 description: The `options` parameter can be a WHATWG `URL` object.
18031807-->
18041808
1805- * ` options ` {Object | string | URL} Accepts the same ` options ` as
1809+ * ` url ` {string | URL}
1810+ * ` options ` {Object} Accepts the same ` options ` as
18061811 [ ` http.request() ` ] [ ] , with the ` method ` always set to ` GET ` .
18071812 Properties that are inherited from the prototype are ignored.
18081813* ` callback ` {Function}
@@ -1866,15 +1871,20 @@ Global instance of `Agent` which is used as the default for all HTTP client
18661871requests.
18671872
18681873## http.request(options[ , callback] )
1874+ ## http.request(url[ , options] [ , callback ] )
18691875<!-- YAML
18701876added: v0.3.6
18711877changes:
1878+ - version: REPLACEME
1879+ pr-url: https://github.com/nodejs/node/pull/21616
1880+ description: allow both url and options to be passed to `http.request()`
18721881 - version: v7.5.0
18731882 pr-url: https://github.com/nodejs/node/pull/10638
18741883 description: The `options` parameter can be a WHATWG `URL` object.
18751884-->
18761885
1877- * ` options ` {Object | string | URL}
1886+ * ` url ` {string | URL}
1887+ * ` options ` {Object}
18781888 * ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
18791889 * ` host ` {string} A domain name or IP address of the server to issue the
18801890 request to. ** Default:** ` 'localhost' ` .
@@ -1916,10 +1926,13 @@ changes:
19161926Node.js maintains several connections per server to make HTTP requests.
19171927This function allows one to transparently issue requests.
19181928
1919- ` options ` can be an object, a string, or a [ ` URL ` ] [ ] object. If ` options ` is a
1929+ ` url ` can be a string or a [ ` URL ` ] [ ] object. If ` url ` is a
19201930string, it is automatically parsed with [ ` url.parse() ` ] [ ] . If it is a [ ` URL ` ] [ ]
19211931object, it will be automatically converted to an ordinary ` options ` object.
19221932
1933+ If both ` url ` and ` options ` are specified, the objects are merged, with the
1934+ ` options ` properties taking precedence.
1935+
19231936The optional ` callback ` parameter will be added as a one-time listener for
19241937the [ ` 'response' ` ] [ ] event.
19251938
0 commit comments