mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 17:01:08 +00:00

PR-URL: https://github.com/nodejs/node/pull/13013 Reviewed-By: James M Snell <jasnell@gmail.com>
21 lines
469 B
JavaScript
21 lines
469 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
let serverRes;
|
|
const server = http.Server(function(req, res) {
|
|
res.write('Part of my res.');
|
|
serverRes = res;
|
|
});
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
http.get({
|
|
port: this.address().port,
|
|
headers: { connection: 'keep-alive' }
|
|
}, common.mustCall(function(res) {
|
|
server.close();
|
|
serverRes.destroy();
|
|
res.on('aborted', common.mustCall());
|
|
}));
|
|
}));
|