node/test/parallel/test-http-client-abort-response-event.js
Tadhg Creedon f5b8853d40 test: reach res._dump after abort ClientRequest
PR-URL: https://github.com/nodejs/node/pull/24191
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2018-11-28 19:25:53 -08:00

23 lines
489 B
JavaScript

'use strict';
const common = require('../common');
const http = require('http');
const net = require('net');
const server = http.createServer(function(req, res) {
res.end();
});
server.listen(0, common.mustCall(function() {
const req = http.request({
port: this.address().port
}, common.mustCall());
req.on('abort', common.mustCall(function() {
server.close();
}));
req.end();
req.abort();
req.emit('response', new http.IncomingMessage(new net.Socket()));
}));