Skip to content

Commit b4ad5d7

Browse files
committed
doc: improve http.request and https.request opts
This adds a few previously undocumented option to both functions. PR-URL: #1551 Fixes: #1082 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 550c263 commit b4ad5d7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

doc/api/http.markdown

+8-4
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,14 @@ Options:
460460

461461
- `host`: A domain name or IP address of the server to issue the request to.
462462
Defaults to `'localhost'`.
463-
- `hostname`: To support `url.parse()` `hostname` is preferred over `host`
463+
- `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
464+
preferred over `host`.
465+
- `family`: IP address family to use when resolving `host` and `hostname`.
466+
Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be
467+
used.
464468
- `port`: Port of remote server. Defaults to 80.
465469
- `localAddress`: Local interface to bind for network connections.
466-
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath)
470+
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath).
467471
- `method`: A string specifying the HTTP request method. Defaults to `'GET'`.
468472
- `path`: Request path. Defaults to `'/'`. Should include query string if any.
469473
E.G. `'/index.html?page=12'`. An exception is thrown when the request path
@@ -474,7 +478,7 @@ Options:
474478
Authorization header.
475479
- `agent`: Controls [Agent][] behavior. When an Agent is used request will
476480
default to `Connection: keep-alive`. Possible values:
477-
- `undefined` (default): use [global Agent][] for this host and port.
481+
- `undefined` (default): use [globalAgent][] for this host and port.
478482
- `Agent` object: explicitly use the passed in `Agent`.
479483
- `false`: opts out of connection pooling with an Agent, defaults request to
480484
`Connection: close`.
@@ -1069,7 +1073,7 @@ authentication details.
10691073
[EventEmitter]: events.html#events_class_events_eventemitter
10701074
[Readable Stream]: stream.html#stream_class_stream_readable
10711075
[Writable Stream]: stream.html#stream_class_stream_writable
1072-
[global Agent]: #http_http_globalagent
1076+
[globalAgent]: #http_http_globalagent
10731077
[http.ClientRequest]: #http_class_http_clientrequest
10741078
[http.IncomingMessage]: #http_http_incomingmessage
10751079
[http.ServerResponse]: #http_class_http_serverresponse

doc/api/https.markdown

+10-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@ The options argument has the following options
103103

104104
- `host`: A domain name or IP address of the server to issue the request to.
105105
Defaults to `'localhost'`.
106-
- `hostname`: To support `url.parse()` `hostname` is preferred over `host`
106+
- `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
107+
preferred over `host`.
108+
- `family`: IP address family to use when resolving `host` and `hostname`.
109+
Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be
110+
used.
107111
- `port`: Port of remote server. Defaults to 443.
112+
- `localAddress`: Local interface to bind for network connections.
113+
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath).
108114
- `method`: A string specifying the HTTP request method. Defaults to `'GET'`.
109115
- `path`: Request path. Defaults to `'/'`. Should include query string if any.
110-
E.G. `'/index.html?page=12'`
116+
E.G. `'/index.html?page=12'`. An exception is thrown when the request path
117+
contains illegal characters. Currently, only spaces are rejected but that
118+
may change in the future.
111119
- `headers`: An object containing request headers.
112120
- `auth`: Basic authentication i.e. `'user:password'` to compute an
113121
Authorization header.

0 commit comments

Comments
 (0)