Skip to content

Commit

Permalink
test: add test for HTTP client "aborted" event
Browse files Browse the repository at this point in the history
PR-URL: #7376
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
kemitchell authored and Myles Borins committed Nov 22, 2016
1 parent e08173a commit d9955fb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/parallel/test-http-client-aborted-event.js
Original file line number Diff line number Diff line change
@@ -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() {}));
}));
}));

0 comments on commit d9955fb

Please sign in to comment.