|
|
@ -34,7 +34,7 @@ Example: |
|
|
|
## https.request(options, callback) |
|
|
|
|
|
|
|
Makes a request to a secure web server. |
|
|
|
All options from [`http.request()`](http.html#http.request) are valid. |
|
|
|
All options from [http.request()](http.html#http.request) are valid. |
|
|
|
|
|
|
|
Example: |
|
|
|
|
|
|
@ -68,12 +68,30 @@ The options argument has the following options |
|
|
|
- path: Path to request. Default `'/'`. |
|
|
|
- method: HTTP request method. Default `'GET'`. |
|
|
|
|
|
|
|
The following options can also be specified. |
|
|
|
However, a global [Agent](http.html#http.Agent) cannot be used. |
|
|
|
|
|
|
|
- key: Private key to use for SSL. Default `null`. |
|
|
|
- cert: Public x509 certificate to use. Default `null`. |
|
|
|
- ca: An authority certificate or array of authority certificates to check |
|
|
|
- `host`: A domain name or IP address of the server to issue the request to. |
|
|
|
Defaults to `'localhost'`. |
|
|
|
- `hostname`: To support `url.parse()` `hostname` is prefered over `host` |
|
|
|
- `port`: Port of remote server. Defaults to 443. |
|
|
|
- `method`: A string specifying the HTTP request method. Defaults to `'GET'`. |
|
|
|
- `path`: Request path. Defaults to `'/'`. Should include query string if any. |
|
|
|
E.G. `'/index.html?page=12'` |
|
|
|
- `headers`: An object containing request headers. |
|
|
|
- `auth`: Basic authentication i.e. `'user:password'` to compute an |
|
|
|
Authorization header. |
|
|
|
- `agent`: Controls [Agent](#https.Agent) behavior. When an Agent is |
|
|
|
used request will default to `Connection: keep-alive`. Possible values: |
|
|
|
- `undefined` (default): use [globalAgent](#https.globalAgent) for this |
|
|
|
host and port. |
|
|
|
- `Agent` object: explicitly use the passed in `Agent`. |
|
|
|
- `false`: opts out of connection pooling with an Agent, defaults request to |
|
|
|
`Connection: close`. |
|
|
|
|
|
|
|
The following options from [tls.connect()](tls.html#tls.connect) can also be |
|
|
|
specified. However, a [globalAgent](#https.globalAgent) silently ignores these. |
|
|
|
|
|
|
|
- `key`: Private key to use for SSL. Default `null`. |
|
|
|
- `cert`: Public x509 certificate to use. Default `null`. |
|
|
|
- `ca`: An authority certificate or array of authority certificates to check |
|
|
|
the remote host against. |
|
|
|
|
|
|
|
In order to specify these options, use a custom `Agent`. |
|
|
@ -133,5 +151,13 @@ Example: |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
## https.Agent |
|
|
|
|
|
|
|
An Agent object for HTTPS similer to [http.Agent](http.html#http.Agent). |
|
|
|
See [https.request()](#https.request) for more information. |
|
|
|
|
|
|
|
|
|
|
|
## https.globalAgent |
|
|
|
|
|
|
|
Global instance of [https.Agent](#https.Agent) which is used as the default |
|
|
|
for all HTTPS client requests. |
|
|
|