mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
738 B
33 lines
738 B
var c = new node.http.Client(8000, "localhost")
|
|
|
|
var req = c.get("/hello/world", [["Accept", "*/*"]]);
|
|
req.finish(function (res) {
|
|
puts("response 1: " + res.status_code.toString());
|
|
|
|
res.onBody = function (chunk) {
|
|
puts("response 1 body <" + chunk.encodeUtf8() + ">");
|
|
return true;
|
|
};
|
|
|
|
res.onBodyComplete = function () {
|
|
puts("response 1 complete!");
|
|
return true;
|
|
};
|
|
});
|
|
|
|
/*
|
|
var req = c.get("/something/else", []);
|
|
req.finish(function (res) {
|
|
puts("response 2: " + res.status_code.toString());
|
|
|
|
res.onBody = function (chunk) {
|
|
puts("response 2 body <" + chunk.encodeUtf8() + ">");
|
|
return true;
|
|
};
|
|
|
|
res.onBodyComplete = function () {
|
|
puts("response 2 complete!");
|
|
return true;
|
|
};
|
|
});
|
|
*/
|
|
|