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.
37 lines
792 B
37 lines
792 B
14 years ago
|
// Serving up a zero-length buffer should work.
|
||
|
|
||
14 years ago
|
var common = require('../common');
|
||
14 years ago
|
var assert = require('assert');
|
||
14 years ago
|
var http = require('http');
|
||
|
|
||
14 years ago
|
var server = http.createServer(function(req, res) {
|
||
14 years ago
|
var buffer = new Buffer(0);
|
||
14 years ago
|
// FIXME: WTF gjslint want this?
|
||
14 years ago
|
res.writeHead(200, {'Content-Type': 'text/html',
|
||
14 years ago
|
'Content-Length': buffer.length});
|
||
14 years ago
|
res.end(buffer);
|
||
|
});
|
||
|
|
||
|
var gotResponse = false;
|
||
|
var resBodySize = 0;
|
||
|
|
||
14 years ago
|
server.listen(common.PORT, function() {
|
||
14 years ago
|
http.get({ port: common.PORT }, function(res) {
|
||
14 years ago
|
gotResponse = true;
|
||
|
|
||
14 years ago
|
res.on('data', function(d) {
|
||
14 years ago
|
resBodySize += d.length;
|
||
|
});
|
||
|
|
||
14 years ago
|
res.on('end', function(d) {
|
||
14 years ago
|
server.close();
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
|
||
14 years ago
|
process.on('exit', function() {
|
||
14 years ago
|
assert.ok(gotResponse);
|
||
|
assert.equal(0, resBodySize);
|
||
|
});
|
||
|
|