doc: improve http.request and https.request opts

This adds a few previously undocumented option to both functions.

PR-URL: https://github.com/iojs/io.js/pull/1551
Fixes: https://github.com/iojs/io.js/issues/1082
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
pull/1551/merge
Roman Reiss 2015-04-28 18:30:58 +02:00
parent 550c2638c0
commit b4ad5d7050
2 changed files with 18 additions and 6 deletions

View File

@ -460,10 +460,14 @@ Options:
- `host`: A domain name or IP address of the server to issue the request to. - `host`: A domain name or IP address of the server to issue the request to.
Defaults to `'localhost'`. Defaults to `'localhost'`.
- `hostname`: To support `url.parse()` `hostname` is preferred over `host` - `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
preferred over `host`.
- `family`: IP address family to use when resolving `host` and `hostname`.
Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be
used.
- `port`: Port of remote server. Defaults to 80. - `port`: Port of remote server. Defaults to 80.
- `localAddress`: Local interface to bind for network connections. - `localAddress`: Local interface to bind for network connections.
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath) - `socketPath`: Unix Domain Socket (use one of host:port or socketPath).
- `method`: A string specifying the HTTP request method. Defaults to `'GET'`. - `method`: A string specifying the HTTP request method. Defaults to `'GET'`.
- `path`: Request path. Defaults to `'/'`. Should include query string if any. - `path`: Request path. Defaults to `'/'`. Should include query string if any.
E.G. `'/index.html?page=12'`. An exception is thrown when the request path E.G. `'/index.html?page=12'`. An exception is thrown when the request path

View File

@ -103,11 +103,19 @@ The options argument has the following options
- `host`: A domain name or IP address of the server to issue the request to. - `host`: A domain name or IP address of the server to issue the request to.
Defaults to `'localhost'`. Defaults to `'localhost'`.
- `hostname`: To support `url.parse()` `hostname` is preferred over `host` - `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
preferred over `host`.
- `family`: IP address family to use when resolving `host` and `hostname`.
Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be
used.
- `port`: Port of remote server. Defaults to 443. - `port`: Port of remote server. Defaults to 443.
- `localAddress`: Local interface to bind for network connections.
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath).
- `method`: A string specifying the HTTP request method. Defaults to `'GET'`. - `method`: A string specifying the HTTP request method. Defaults to `'GET'`.
- `path`: Request path. Defaults to `'/'`. Should include query string if any. - `path`: Request path. Defaults to `'/'`. Should include query string if any.
E.G. `'/index.html?page=12'` 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.
- `headers`: An object containing request headers. - `headers`: An object containing request headers.
- `auth`: Basic authentication i.e. `'user:password'` to compute an - `auth`: Basic authentication i.e. `'user:password'` to compute an
Authorization header. Authorization header.