mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
17 lines
399 B
JavaScript
17 lines
399 B
JavaScript
var c = new node.http.Client(8000, "localhost")
|
|
|
|
var req = c.get("/hello/world", [["Accept", "*/*"]]);
|
|
req.finish(function (res) {
|
|
puts("got response: " + res.status_code.toString());
|
|
|
|
res.onBody = function (chunk) {
|
|
puts("got response body <" + chunk.encodeUtf8() + ">");
|
|
return true;
|
|
};
|
|
|
|
res.onBodyComplete = function () {
|
|
puts("response complete!");
|
|
return true;
|
|
};
|
|
});
|