Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test, http: add regression test for keepalive 'end' event
This test covers a regression where 'end' was not emitted in the case
of keepalive requests without parsing the full body.
  • Loading branch information
mcollina committed Aug 22, 2019
commit 3bef00e8b6e89df22d1b6ef9e5b7478551ae6148
29 changes: 29 additions & 0 deletions test/parallel/test-http-server-keepalive-end.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const common = require('../common');
const { createServer } = require('http');
const { connect } = require('net');

const server = createServer(common.mustCall((req, res) => {
req.on('end', common.mustCall());
res.end('hello world');
}));

server.unref();

server.listen(0, common.mustCall(() => {

const client = connect(server.address().port);

const req = [
'POST / HTTP/1.1',
`Host: localhost:${server.address().port}`,
'Connection: keep-alive',
'Content-Length: 11',
'',
'hello world',
''
].join('\r\n');

client.end(req);
}));