mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
24 lines
622 B
JavaScript
24 lines
622 B
JavaScript
var common = require('../common');
|
|
var http = require("http");
|
|
|
|
// Simple test of Node's HTTP Client choking on a response with a "Content-Length: 0 " response header.
|
|
// I.E. a space character after the "Content-Length" throws an `error` event.
|
|
|
|
|
|
var s = http.createServer(function(req, res) {
|
|
res.writeHead(200, { "Content-Length": "0 " });
|
|
res.end();
|
|
});
|
|
s.listen(common.PORT, function() {
|
|
|
|
var r = http.createClient(common.PORT);
|
|
var request = r.request('GET', '/');
|
|
|
|
request.on('response', function (response) {
|
|
console.log('STATUS: ' + response.statusCode);
|
|
s.close();
|
|
});
|
|
|
|
request.end();
|
|
});
|