0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test_client.js

17 lines
399 B
JavaScript
Raw Normal View History

2009-05-19 13:12:46 +02:00
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;
};
});