From f97d339ce763d269b76aa8bb5add8c6006531c79 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 2 Nov 2009 22:55:39 +0100 Subject: [PATCH] Add requires to google example in docs. --- doc/api.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/api.txt b/doc/api.txt index 2e8c1b0e697..32aab9b11da 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -860,14 +860,16 @@ connection. _Currently the implementation does not pipeline requests._ Example of connecting to +google.com+ ---------------------------------------- -var google = http.createClient(80, "google.com"); -var request = google.get("/"); +var sys = require("sys"), + http = require("http"); +var google = http.createClient(80, "www.google.com"); +var request = google.get("/", {"host": "www.google.com"}); request.finish(function (response) { - puts("STATUS: " + response.statusCode); - puts("HEADERS: " + JSON.stringify(response.headers)); + sys.puts("STATUS: " + response.statusCode); + sys.puts("HEADERS: " + JSON.stringify(response.headers)); response.setBodyEncoding("utf8"); response.addListener("body", function (chunk) { - puts("BODY: " + chunk); + sys.puts("BODY: " + chunk); }); }); ----------------------------------------