mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
f9b739ebbc
Fixes: https://github.com/nodejs/node/issues/20795 PR-URL: https://github.com/nodejs/node/pull/21616 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
29 lines
682 B
JavaScript
29 lines
682 B
JavaScript
'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();
|
|
})
|
|
);
|
|
})
|
|
);
|
|
}
|