summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-client-aborted-event.js
blob: 951a128f51b26158e17dfda04240aac92fea365c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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() {}));
  }));
}));