From 326bce91d680ccf4a263f6c8696865cc800412d0 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Mon, 29 Oct 2012 16:16:40 +1300 Subject: 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. --- doc/api/http.markdown | 8 ++++---- doc/api/https.markdown | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/http.markdown b/doc/api/http.markdown index e8bf483f0..59a9f8a30 100644 --- a/doc/api/http.markdown +++ b/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' diff --git a/doc/api/https.markdown b/doc/api/https.markdown index f91948e59..090e22947 100644 --- a/doc/api/https.markdown +++ b/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', -- cgit v1.2.1