From e3282bace47f763a2dca3bc26bcee998b63a95c6 Mon Sep 17 00:00:00 2001 From: Tadhg Creedon Date: Tue, 6 Nov 2018 16:56:34 +0000 Subject: [PATCH 1/3] test: reach res._dump after abort ClientRequest --- test/parallel/test-http-client-abort-event.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-http-client-abort-event.js b/test/parallel/test-http-client-abort-event.js index 0392060196405c..d5d6958deefaa6 100644 --- a/test/parallel/test-http-client-abort-event.js +++ b/test/parallel/test-http-client-abort-event.js @@ -1,6 +1,7 @@ 'use strict'; const common = require('../common'); const http = require('http'); +const net = require('net'); const server = http.createServer(function(req, res) { res.end(); }); @@ -8,7 +9,7 @@ const server = http.createServer(function(req, res) { server.listen(0, common.mustCall(function() { const req = http.request({ port: this.address().port - }, common.mustNotCall()); + }, common.mustCall()); req.on('abort', common.mustCall(function() { server.close(); @@ -17,4 +18,6 @@ server.listen(0, common.mustCall(function() { req.end(); req.abort(); req.abort(); + + req.emit('response', new http.IncomingMessage(new net.Socket())); })); From c37a91d18fedcf0837f2c3012051dfc5d7217009 Mon Sep 17 00:00:00 2001 From: Tadhg Creedon Date: Sun, 11 Nov 2018 12:27:53 +0000 Subject: [PATCH 2/3] move changes to new test file --- test/parallel/test-http-client-abort-event.js | 5 +--- .../test-http-client-abort-response-event.js | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 test/parallel/test-http-client-abort-response-event.js diff --git a/test/parallel/test-http-client-abort-event.js b/test/parallel/test-http-client-abort-event.js index d5d6958deefaa6..0392060196405c 100644 --- a/test/parallel/test-http-client-abort-event.js +++ b/test/parallel/test-http-client-abort-event.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const http = require('http'); -const net = require('net'); const server = http.createServer(function(req, res) { res.end(); }); @@ -9,7 +8,7 @@ const server = http.createServer(function(req, res) { server.listen(0, common.mustCall(function() { const req = http.request({ port: this.address().port - }, common.mustCall()); + }, common.mustNotCall()); req.on('abort', common.mustCall(function() { server.close(); @@ -18,6 +17,4 @@ server.listen(0, common.mustCall(function() { req.end(); req.abort(); req.abort(); - - req.emit('response', new http.IncomingMessage(new net.Socket())); })); 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..d5d6958deefaa6 --- /dev/null +++ b/test/parallel/test-http-client-abort-response-event.js @@ -0,0 +1,23 @@ +'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.abort(); + + req.emit('response', new http.IncomingMessage(new net.Socket())); +})); From d8631d0f6412f8ca9d6a8ed7cdc9b5a8096c9c74 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 27 Nov 2018 22:07:23 -0800 Subject: [PATCH 3/3] fixup! remove extra `.abort()` call --- test/parallel/test-http-client-abort-response-event.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/parallel/test-http-client-abort-response-event.js b/test/parallel/test-http-client-abort-response-event.js index d5d6958deefaa6..c8a80f57884fb7 100644 --- a/test/parallel/test-http-client-abort-response-event.js +++ b/test/parallel/test-http-client-abort-response-event.js @@ -17,7 +17,6 @@ server.listen(0, common.mustCall(function() { req.end(); req.abort(); - req.abort(); req.emit('response', new http.IncomingMessage(new net.Socket())); }));