Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <ry@tinyclouds.org>2009-05-19 15:12:46 +0400
committerRyan <ry@tinyclouds.org>2009-05-19 15:12:46 +0400
commit87e6578aa9e15c7c57cabc6562a8dc68aa04aff4 (patch)
tree7a2f8b9bdd7326f2d7d9ac54da798501076a6e29 /test_client.js
parent3bc73ba9674d0fda4dc04edbe08cfb92b15f2461 (diff)
Simple HTTP client is working a bit.
Diffstat (limited to 'test_client.js')
-rw-r--r--test_client.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test_client.js b/test_client.js
new file mode 100644
index 00000000000..8e37f680286
--- /dev/null
+++ b/test_client.js
@@ -0,0 +1,16 @@
+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;
+ };
+});