mirror of
https://github.com/nodejs/node.git
synced 2025-12-27 23:41:14 +00:00
PR-URL: https://github.com/nodejs/node/pull/60729 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
28 lines
570 B
JavaScript
28 lines
570 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
const { finished } = require('stream');
|
|
|
|
{
|
|
// Test abort before finished.
|
|
|
|
const server = http.createServer(function(req, res) {
|
|
res.write('asd');
|
|
});
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
http.request({
|
|
port: this.address().port
|
|
})
|
|
.on('response', common.mustCall((res) => {
|
|
res.on('readable', () => {
|
|
res.destroy();
|
|
});
|
|
finished(res, common.mustCall(() => {
|
|
server.close();
|
|
}));
|
|
}))
|
|
.end();
|
|
}));
|
|
}
|