0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00
nodejs/test_client.js
2009-05-19 13:12:46 +02:00

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;
};
});