Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

doc: reflect hostname v. host preference in examples

The documentation for http.request and https.request states that
`hostname` is preferred over `host` so the code examples should
use that option name.
  • Loading branch information...
commit 326bce91d680ccf4a263f6c8696865cc800412d0 1 parent 5f0a10a
@fmarier fmarier authored bnoordhuis committed
Showing with 7 additions and 7 deletions.
  1. +4 −4 doc/api/http.markdown
  2. +3 −3 doc/api/https.markdown
View
8 doc/api/http.markdown
@@ -505,7 +505,7 @@ upload a file with a POST request, then write to the `ClientRequest` object.
Example:
var options = {
- host: 'www.google.com',
+ hostname: 'www.google.com',
port: 80,
path: '/upload',
method: 'POST'
@@ -594,7 +594,7 @@ pool you can do something along the lines of:
Alternatively, you could just opt out of pooling entirely using `agent:false`:
- http.get({host:'localhost', port:80, path:'/', agent:false}, function (res) {
+ http.get({hostname:'localhost', port:80, path:'/', agent:false}, function (res) {
// Do stuff
})
@@ -719,7 +719,7 @@ A client server pair that show you how to listen for the `connect` event.
// make a request to a tunneling proxy
var options = {
port: 1337,
- host: '127.0.0.1',
+ hostname: '127.0.0.1',
method: 'CONNECT',
path: 'www.google.com:80'
};
@@ -776,7 +776,7 @@ A client server pair that show you how to listen for the `upgrade` event.
// make a request
var options = {
port: 1337,
- host: '127.0.0.1',
+ hostname: '127.0.0.1',
headers: {
'Connection': 'Upgrade',
'Upgrade': 'websocket'
View
6 doc/api/https.markdown
@@ -71,7 +71,7 @@ Example:
var https = require('https');
var options = {
- host: 'encrypted.google.com',
+ hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET'
@@ -137,7 +137,7 @@ In order to specify these options, use a custom `Agent`.
Example:
var options = {
- host: 'encrypted.google.com',
+ hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
@@ -155,7 +155,7 @@ Or does not use an `Agent`.
Example:
var options = {
- host: 'encrypted.google.com',
+ hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET',
Please sign in to comment.
Something went wrong with that request. Please try again.