Documentation update

http.markdown
  note options now align with url.parse
  added note that hostname is preferred over host.
  added auth
  added not that setting an explicit Authorization header will override basic authentication with 'auth'

https.markdown
  Made a link to http.request and noted that all http.request options are valid.

url.markdown
  added path option
This commit is contained in:
seebees
2011-10-19 15:06:49 -07:00
committed by koichik
parent 1ead20f274
commit a2eaddaa51
3 changed files with 13 additions and 2 deletions

View File

@@ -387,11 +387,14 @@ followed by `response.end()`.
## http.request(options, callback)
Node maintains several connections per server to make HTTP requests.
This function allows one to transparently issue requests.
This function allows one to transparently issue requests. Options align
with `url.parse`.
Options:
- `host`: A domain name or IP address of the server to issue the request to.
- `hostname`: To support `url.parse` `hostname` is prefered over
`host`
- `port`: Port of remote server.
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath)
- `method`: A string specifying the HTTP request method. Possible values:
@@ -399,6 +402,8 @@ Options:
- `path`: Request path. Should include query string and fragments 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` behavior. When an Agent is used request will default to
Connection:keep-alive. Possible values:
- `undefined` (default): use default `Agent` for this host and port.
@@ -456,6 +461,9 @@ There are a few special headers that should be noted.
and listen for the `continue` event. See RFC2616 Section 8.2.3 for more
information.
* Sending an Authorization header will override useing the `auth` option
to compute basic authentication.
## http.get(options, callback)
Since most requests are GET requests without bodies, Node provides this

View File

@@ -34,7 +34,7 @@ Example:
## https.request(options, callback)
Makes a request to a secure web server.
Similar options to `http.request()`.
All options from [`http.request()`](http.html#http.request) are valid.
Example:

View File

@@ -33,6 +33,9 @@ string will not be in the parsed object. Examples are shown for the URL
* `search`: The 'query string' portion of the URL, including the leading question mark.
Example: `'?query=string'`
* `path`: Concatenation of `pathname` and `search`.
Example: `'/p/a/t/h?query=string'`
* `query`: Either the 'params' portion of the query string, or a querystring-parsed object.
Example: `'query=string'` or `{'query':'string'}`