blob: 46ae0c0e2971586a432897bb169315ad9f9a5884 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
'use strict';
const common = require('../common');
const { createServer } = require('http');
const { connect } = require('net');
// Make sure that calling the semi-private close() handlers manually doesn't
// cause an error.
const server = createServer(common.mustCall((req, res) => {
req.client._events.close.forEach((fn) => { fn.bind(req)(); });
}));
server.unref();
server.listen(0, common.mustCall(() => {
const client = connect(server.address().port);
const req = [
'POST / HTTP/1.1',
'Content-Length: 11',
'',
'hello world',
].join('\r\n');
client.end(req);
}));
|