@@ -1796,15 +1796,20 @@ The `requestListener` is a function which is automatically
17961796added to the [ ` 'request' ` ] [ ] event.
17971797
17981798## http.get(options[ , callback] )
1799+ ## http.get(url[ , options] [ , callback ] )
17991800<!-- YAML
18001801added: v0.3.6
18011802changes:
1803+ - version: REPLACEME
1804+ pr-url: https://github.com/nodejs/node/pull/21616
1805+ description: allow both url and options to be passed to `http.get()`
18021806 - version: v7.5.0
18031807 pr-url: https://github.com/nodejs/node/pull/10638
18041808 description: The `options` parameter can be a WHATWG `URL` object.
18051809-->
18061810
1807- * ` options ` {Object | string | URL} Accepts the same ` options ` as
1811+ * ` url ` {string | URL}
1812+ * ` options ` {Object} Accepts the same ` options ` as
18081813 [ ` http.request() ` ] [ ] , with the ` method ` always set to ` GET ` .
18091814 Properties that are inherited from the prototype are ignored.
18101815* ` callback ` {Function}
@@ -1868,15 +1873,20 @@ Global instance of `Agent` which is used as the default for all HTTP client
18681873requests.
18691874
18701875## http.request(options[ , callback] )
1876+ ## http.request(url[ , options] [ , callback ] )
18711877<!-- YAML
18721878added: v0.3.6
18731879changes:
1880+ - version: REPLACEME
1881+ pr-url: https://github.com/nodejs/node/pull/21616
1882+ description: allow both url and options to be passed to `http.request()`
18741883 - version: v7.5.0
18751884 pr-url: https://github.com/nodejs/node/pull/10638
18761885 description: The `options` parameter can be a WHATWG `URL` object.
18771886-->
18781887
1879- * ` options ` {Object | string | URL}
1888+ * ` url ` {string | URL}
1889+ * ` options ` {Object}
18801890 * ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
18811891 * ` host ` {string} A domain name or IP address of the server to issue the
18821892 request to. ** Default:** ` 'localhost' ` .
@@ -1918,10 +1928,13 @@ changes:
19181928Node.js maintains several connections per server to make HTTP requests.
19191929This function allows one to transparently issue requests.
19201930
1921- ` options ` can be an object, a string, or a [ ` URL ` ] [ ] object. If ` options ` is a
1931+ ` url ` can be a string or a [ ` URL ` ] [ ] object. If ` url ` is a
19221932string, it is automatically parsed with [ ` new URL() ` ] [ ] . If it is a [ ` URL ` ] [ ]
19231933object, it will be automatically converted to an ordinary ` options ` object.
19241934
1935+ If both ` url ` and ` options ` are specified, the objects are merged, with the
1936+ ` options ` properties taking precedence.
1937+
19251938The optional ` callback ` parameter will be added as a one-time listener for
19261939the [ ` 'response' ` ] [ ] event.
19271940
0 commit comments