mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01: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;
|
||
|
};
|
||
|
});
|