summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-request-arguments.js
blob: 5cdd514fd50685ad31749cb97c02b2e5f4bbcc3b (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
26
27
28
'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');

// Test providing both a url and options, with the options partially
// replacing address and port portions of the URL provided.
{
  const server = http.createServer(
    common.mustCall((req, res) => {
      assert.strictEqual(req.url, '/testpath');
      res.end();
      server.close();
    })
  );
  server.listen(
    0,
    common.mustCall(() => {
      http.get(
        'http://example.com/testpath',
        { hostname: 'localhost', port: server.address().port },
        common.mustCall((res) => {
          res.resume();
        })
      );
    })
  );
}