node/test/simple/test-http-chunked.js

18 lines
431 B
JavaScript
Raw Normal View History

require("../common");
2010-03-20 10:22:04 +08:00
var http = require("http");
var UTF8_STRING = "Il était tué";
var server = http.createServer(function(req, res) {
2010-02-26 04:54:48 +08:00
res.writeHead(200, {"Content-Type": "text/plain; charset=utf8"});
res.write(UTF8_STRING, 'utf8');
res.close();
});
server.listen(PORT);
2010-03-19 05:01:17 +08:00
http.cat("http://127.0.0.1:"+PORT+"/", "utf8", function (err, data) {
2010-02-20 08:26:48 +08:00
if (err) throw err;
assert.equal(UTF8_STRING, data);
server.close();
})