From 6ba3b7664d47d06f453230b86864090c286b8212 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 16 Feb 2019 18:56:20 +0100 Subject: [PATCH 1/2] doc: add documentation for the defaultPort option --- doc/api/http.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/http.md b/doc/api/http.md index bd183d329a078e..46936d4c7ddd0b 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1977,7 +1977,10 @@ changes: * `family` {number} IP address family to use when resolving `host` or `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be used. - * `port` {number} Port of remote server. **Default:** `80`. + * `defaultPort` {number} Default port for the protocol. **Default:** + `agent.defaultPort` if an `Agent` is used, else `undefined`. + * `port` {number} Port of remote server. **Default:** `defaultPort` if set, + else `80`. * `localAddress` {string} Local interface to bind for network connections. * `socketPath` {string} Unix Domain Socket (cannot be used if one of `host` or `port` is specified, those specify a TCP Socket). From c39aebfcde7bf967b6fff8f3a5615f18b84b02f7 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 16 Feb 2019 19:47:27 +0100 Subject: [PATCH 2/2] doc: sort http.request() options alphabetically --- doc/api/http.md | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index 46936d4c7ddd0b..2bd45a2d4bc56d 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1969,44 +1969,44 @@ changes: * `url` {string | URL} * `options` {Object} - * `protocol` {string} Protocol to use. **Default:** `'http:'`. + * `agent` {http.Agent | boolean} Controls [`Agent`][] behavior. Possible + values: + * `undefined` (default): use [`http.globalAgent`][] for this host and port. + * `Agent` object: explicitly use the passed in `Agent`. + * `false`: causes a new `Agent` with default values to be used. + * `auth` {string} Basic authentication i.e. `'user:password'` to compute an + Authorization header. + * `createConnection` {Function} A function that produces a socket/stream to + use for the request when the `agent` option is not used. This can be used to + avoid creating a custom `Agent` class just to override the default + `createConnection` function. See [`agent.createConnection()`][] for more + details. Any [`Duplex`][] stream is a valid return value. + * `defaultPort` {number} Default port for the protocol. **Default:** + `agent.defaultPort` if an `Agent` is used, else `undefined`. + * `family` {number} IP address family to use when resolving `host` or + `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and + v6 will be used. + * `headers` {Object} An object containing request headers. * `host` {string} A domain name or IP address of the server to issue the request to. **Default:** `'localhost'`. * `hostname` {string} Alias for `host`. To support [`url.parse()`][], `hostname` will be used if both `host` and `hostname` are specified. - * `family` {number} IP address family to use when resolving `host` or - `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and - v6 will be used. - * `defaultPort` {number} Default port for the protocol. **Default:** - `agent.defaultPort` if an `Agent` is used, else `undefined`. - * `port` {number} Port of remote server. **Default:** `defaultPort` if set, - else `80`. * `localAddress` {string} Local interface to bind for network connections. - * `socketPath` {string} Unix Domain Socket (cannot be used if one of `host` - or `port` is specified, those specify a TCP Socket). * `method` {string} A string specifying the HTTP request method. **Default:** `'GET'`. * `path` {string} Request path. Should include query string if any. E.G. `'/index.html?page=12'`. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future. **Default:** `'/'`. - * `headers` {Object} An object containing request headers. - * `auth` {string} Basic authentication i.e. `'user:password'` to compute an - Authorization header. - * `agent` {http.Agent | boolean} Controls [`Agent`][] behavior. Possible - values: - * `undefined` (default): use [`http.globalAgent`][] for this host and port. - * `Agent` object: explicitly use the passed in `Agent`. - * `false`: causes a new `Agent` with default values to be used. - * `createConnection` {Function} A function that produces a socket/stream to - use for the request when the `agent` option is not used. This can be used to - avoid creating a custom `Agent` class just to override the default - `createConnection` function. See [`agent.createConnection()`][] for more - details. Any [`Duplex`][] stream is a valid return value. - * `timeout` {number}: A number specifying the socket timeout in milliseconds. - This will set the timeout before the socket is connected. + * `port` {number} Port of remote server. **Default:** `defaultPort` if set, + else `80`. + * `protocol` {string} Protocol to use. **Default:** `'http:'`. * `setHost` {boolean}: Specifies whether or not to automatically add the `Host` header. Defaults to `true`. + * `socketPath` {string} Unix Domain Socket (cannot be used if one of `host` + 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. * `callback` {Function} * Returns: {http.ClientRequest}