• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const http = require('http');
5
6// Test providing both a url and options, with the options partially
7// replacing address and port portions of the URL provided.
8{
9  const server = http.createServer(
10    common.mustCall((req, res) => {
11      assert.strictEqual(req.url, '/testpath');
12      res.end();
13      server.close();
14    })
15  );
16  server.listen(
17    0,
18    common.mustCall(() => {
19      http.get(
20        'http://example.com/testpath',
21        { hostname: 'localhost', port: server.address().port },
22        common.mustCall((res) => {
23          res.resume();
24        })
25      );
26    })
27  );
28}
29