mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Backport-PR-URL: https://github.com/nodejs/node/pull/13835 PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
25 lines
616 B
JavaScript
25 lines
616 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.
|
|
|
|
|
|
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();
|
|
});
|