0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/simple/test-http-contentLength0.js
Oleg Efimov 093dfaf801 GJSLint all tests, only 3 long lines left in test-url.js
test/simple/test-url.js:31:(0110) Line too long (82 characters).
test/simple/test-url.js:39:(0110) Line too long (85 characters).
test/simple/test-url.js:40:(0110) Line too long (92 characters).
2010-12-05 15:42:41 -08:00

25 lines
621 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();
});