mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 09:52:21 +00:00

Refs: https://github.com/nodejs/node/issues/33591 PR-URL: https://github.com/nodejs/node/pull/33654 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
25 lines
521 B
JavaScript
25 lines
521 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer(common.mustCall((req, res) => {
|
|
req.pipe(res);
|
|
res.on('error', common.mustNotCall());
|
|
res.on('close', common.mustCall(() => {
|
|
res.end('asd');
|
|
process.nextTick(() => {
|
|
server.close();
|
|
});
|
|
}));
|
|
})).listen(0, () => {
|
|
http
|
|
.request({
|
|
port: server.address().port,
|
|
method: 'PUT'
|
|
})
|
|
.on('response', (res) => {
|
|
res.destroy();
|
|
})
|
|
.write('asd');
|
|
});
|