Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doc: clarify http.request language
Improve messaging for http.request's host and hostname parameters, as per
nodejs/node-v0.x-archive#8990. I can't even count the number of times I've looked at the
http docs to see whether host or hostname lets you include a port for
http.request.

The current language in the docs says that the host parameter is "A domain name
or IP address of the server to issue the request to. Defaults to 'localhost',"
and described the hostname parameter with "To support url.parse() hostname is
preferred over host." The host description actually fits the hostname parameter
better, and it seems like the host description needs to say something about
allowing a port.

Signed-off-by: Eli Skeggs <skeggse@gmail.com>
  • Loading branch information
skeggse committed Aug 18, 2015
commit 6e102ed898969612be0350ad9a68ab3fab8702cd
8 changes: 4 additions & 4 deletions doc/api/http.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,10 @@ automatically parsed with [url.parse()][].
Options:

- `protocol`: Protocol to use. Defaults to `'http'`.
- `host`: A domain name or IP address of the server to issue the request to.
Defaults to `'localhost'`.
- `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
preferred over `host`.
- `host`: A domain name or IP address of the server to issue the request to,
optionally including a colon-prefixed port number. Defaults to `'localhost'`.
- `hostname`: A domain name or IP address. May not include colon-prefixed port
number. 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.
Expand Down