mirror of
https://github.com/nodejs/node.git
synced 2025-04-30 15:41:06 +00:00

PR-URL: https://github.com/nodejs/node/pull/10550 Reviewed-By: Rich Trott <rtrott@gmail.com>
24 lines
590 B
JavaScript
24 lines
590 B
JavaScript
'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.
|
|
|
|
|
|
var s = http.createServer(function(req, res) {
|
|
res.writeHead(200, {'Content-Length': '0 '});
|
|
res.end();
|
|
});
|
|
s.listen(0, function() {
|
|
|
|
var request = http.request({ port: this.address().port }, function(response) {
|
|
console.log('STATUS: ' + response.statusCode);
|
|
s.close();
|
|
response.resume();
|
|
});
|
|
|
|
request.end();
|
|
});
|