@@ -1798,15 +1798,20 @@ The `requestListener` is a function which is automatically
17981798added to the [ ` 'request' ` ] [ ] event.
17991799
18001800## http.get(options[ , callback] )
1801+ ## http.get(url[ , options] [ , callback ] )
18011802<!-- YAML
18021803added: v0.3.6
18031804changes:
1805+ - version: REPLACEME
1806+ pr-url: https://github.com/nodejs/node/pull/21616
1807+ description: allow both url and options to be passed to `http.get()`
18041808 - version: v7.5.0
18051809 pr-url: https://github.com/nodejs/node/pull/10638
18061810 description: The `options` parameter can be a WHATWG `URL` object.
18071811-->
18081812
1809- * ` options ` {Object | string | URL} Accepts the same ` options ` as
1813+ * ` url ` {string | URL}
1814+ * ` options ` {Object} Accepts the same ` options ` as
18101815 [ ` http.request() ` ] [ ] , with the ` method ` always set to ` GET ` .
18111816 Properties that are inherited from the prototype are ignored.
18121817* ` callback ` {Function}
@@ -1870,15 +1875,20 @@ Global instance of `Agent` which is used as the default for all HTTP client
18701875requests.
18711876
18721877## http.request(options[ , callback] )
1878+ ## http.request(url[ , options] [ , callback ] )
18731879<!-- YAML
18741880added: v0.3.6
18751881changes:
1882+ - version: REPLACEME
1883+ pr-url: https://github.com/nodejs/node/pull/21616
1884+ description: allow both url and options to be passed to `http.request()`
18761885 - version: v7.5.0
18771886 pr-url: https://github.com/nodejs/node/pull/10638
18781887 description: The `options` parameter can be a WHATWG `URL` object.
18791888-->
18801889
1881- * ` options ` {Object | string | URL}
1890+ * ` url ` {string | URL}
1891+ * ` options ` {Object}
18821892 * ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
18831893 * ` host ` {string} A domain name or IP address of the server to issue the
18841894 request to. ** Default:** ` 'localhost' ` .
@@ -1920,10 +1930,13 @@ changes:
19201930Node.js maintains several connections per server to make HTTP requests.
19211931This function allows one to transparently issue requests.
19221932
1923- ` options ` can be an object, a string, or a [ ` URL ` ] [ ] object. If ` options ` is a
1933+ ` url ` can be a string or a [ ` URL ` ] [ ] object. If ` url ` is a
19241934string, it is automatically parsed with [ ` new URL() ` ] [ ] . If it is a [ ` URL ` ] [ ]
19251935object, it will be automatically converted to an ordinary ` options ` object.
19261936
1937+ If both ` url ` and ` options ` are specified, the objects are merged, with the
1938+ ` options ` properties taking precedence.
1939+
19271940The optional ` callback ` parameter will be added as a one-time listener for
19281941the [ ` 'response' ` ] [ ] event.
19291942
0 commit comments