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.
34 lines
719 B
34 lines
719 B
require('../common');
|
|
|
|
assert = require("assert");
|
|
http = require("http");
|
|
sys = require("sys");
|
|
|
|
|
|
body = "hello world\n";
|
|
|
|
server = http.createServer(function (req, res) {
|
|
error('req: ' + req.method);
|
|
res.writeHead(200, {"Content-Length": body.length});
|
|
res.end();
|
|
server.close();
|
|
});
|
|
|
|
var gotEnd = false;
|
|
|
|
server.listen(PORT, function () {
|
|
var client = http.createClient(PORT);
|
|
var request = client.request("HEAD", "/");
|
|
request.addListener('response', function (response) {
|
|
error('response start');
|
|
response.addListener("end", function () {
|
|
error('response end');
|
|
gotEnd = true;
|
|
});
|
|
});
|
|
request.end();
|
|
});
|
|
|
|
process.addListener('exit', function () {
|
|
assert.ok(gotEnd);
|
|
});
|
|
|