From 4e20fbfc15351abd8630e1b9aff8450a1f8946ed Mon Sep 17 00:00:00 2001 From: Tadhg Creedon Date: Tue, 6 Nov 2018 16:56:34 +0000 Subject: [PATCH] test: reach res._dump after abort ClientRequest PR-URL: https://github.com/nodejs/node/pull/24191 Reviewed-By: Ouyang Yadong Reviewed-By: Rich Trott --- .../test-http-client-abort-response-event.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/parallel/test-http-client-abort-response-event.js 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())); +}));