summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-client-abort-unix-socket.js
blob: bf666b7935a3a64d0a0a3e7bc47e717f5d165282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const common = require('../common');
const http = require('http');

const server = http.createServer(common.mustNotCall());

class Agent extends http.Agent {
  createConnection(options, oncreate) {
    const socket = super.createConnection(options, oncreate);
    socket.once('close', () => server.close());
    return socket;
  }
}

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();

server.listen(common.PIPE, common.mustCall(() => {
  const req = http.get({
    agent: new Agent(),
    socketPath: common.PIPE
  });

  req.abort();
}));