mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
9f873b3a65
This reverts commit b03845b937
.
PR-URL: https://github.com/nodejs/node/pull/29717
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
28 lines
553 B
JavaScript
28 lines
553 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', (res) => {
|
|
res.on('readable', () => {
|
|
res.destroy();
|
|
});
|
|
finished(res, common.mustCall(() => {
|
|
server.close();
|
|
}));
|
|
})
|
|
.end();
|
|
}));
|
|
}
|