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.
24 lines
616 B
24 lines
616 B
'use strict';
|
|
require('../common');
|
|
const 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.
|
|
|
|
|
|
const s = http.createServer(function(req, res) {
|
|
res.writeHead(200, {'Content-Length': '0 '});
|
|
res.end();
|
|
});
|
|
s.listen(0, function() {
|
|
|
|
const request =
|
|
http.request({ port: this.address().port }, function(response) {
|
|
console.log(`STATUS: ${response.statusCode}`);
|
|
s.close();
|
|
response.resume();
|
|
});
|
|
|
|
request.end();
|
|
});
|
|
|