forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v10.x backport] http: allow url and options to be passed to http*.re…
…quest and http*.get
- Loading branch information
Showing
5 changed files
with
94 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(); | ||
}) | ||
); | ||
}) | ||
); | ||
} |