From 79010540fccb7c4f6be34bfd76d2ce5c557a526e Mon Sep 17 00:00:00 2001 From: Urban Hafner Date: Wed, 17 Jun 2009 08:01:28 +0200 Subject: [PATCH] Test case for node.http.cat --- test/test-http-cat.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/test-http-cat.js diff --git a/test/test-http-cat.js b/test/test-http-cat.js new file mode 100644 index 0000000000..ef002a2e08 --- /dev/null +++ b/test/test-http-cat.js @@ -0,0 +1,23 @@ +include("mjsunit.js"); +PORT = 8888; + +var body = "exports.A = function() { return 'A';}"; +new node.http.Server(function (req, res) { + res.sendHeader(200, [ + ["Content-Length", body.length], + ["Content-Type", "text/plain"] + ]); + res.sendBody(body); + res.finish(); +}).listen(PORT); + +function onLoad() { + try { + node.http.cat("http://localhost:"+PORT, "utf8", function(status, content) { + assertEquals(body, content); + // TODO: Test the status code + }) + } catch(e) { + assertUnreachable(e) + } +}