From d9955fbb17433ceab2717d149c308a27a8d5de35 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Wed, 22 Jun 2016 16:42:15 -0700 Subject: [PATCH] test: add test for HTTP client "aborted" event PR-URL: https://github.com/nodejs/node/pull/7376 Reviewed-By: James M Snell Reviewed-By: Fedor Indutny Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- .../parallel/test-http-client-aborted-event.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/parallel/test-http-client-aborted-event.js diff --git a/test/parallel/test-http-client-aborted-event.js b/test/parallel/test-http-client-aborted-event.js new file mode 100644 index 00000000000000..951a128f51b261 --- /dev/null +++ b/test/parallel/test-http-client-aborted-event.js @@ -0,0 +1,18 @@ +'use strict'; +const common = require('../common'); +const http = require('http'); + +const server = http.Server(function(req, res) { + res.write('Part of my res.'); + res.destroy(); +}); + +server.listen(0, common.mustCall(function() { + http.get({ + port: this.address().port, + headers: { connection: 'keep-alive' } + }, common.mustCall(function(res) { + server.close(); + res.on('aborted', common.mustCall(function() {})); + })); +}));