summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-client-abort-event.js
blob: 0392060196405cecacbae25affa1b3844145fdde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';
const common = require('../common');
const http = require('http');
const server = http.createServer(function(req, res) {
  res.end();
});

server.listen(0, common.mustCall(function() {
  const req = http.request({
    port: this.address().port
  }, common.mustNotCall());

  req.on('abort', common.mustCall(function() {
    server.close();
  }));

  req.end();
  req.abort();
  req.abort();
}));