diff --git a/test/parallel/test-http-client-abort-response-event.js b/test/parallel/test-http-client-abort-response-event.js new file mode 100644 index 00000000000000..c8a80f57884fb7 --- /dev/null +++ b/test/parallel/test-http-client-abort-response-event.js @@ -0,0 +1,22 @@ +'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())); +}));