-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Description
Version
v20.0.0
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
No response
What steps will reproduce the bug?
var Opt = require('url').parse('https://httpbin.org/get');
require('https')
.request({...Opt,path : Opt.path + '?A=B'},S => S.on('data',D => console.log(D.toString('UTF8'))))
.end()How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Running using v19.9.0, it prints
{
"args": {
"A": "B"
},
"headers": {
"Host": "httpbin.org",
....
},
....
"url": "https://httpbin.org/get?A=B"
}What do you see instead?
{
"args": {},
"headers": {
"Host": "httpbin.org",
...
},
...
"url": "https://httpbin.org/get"
}Additional information
Before #47339, url.isURL checks if property href & origin exists, and it changed to check if property href & protocol exist now.
So before that, the Opt above goes to the else branch of ClientRequest, but now it goes to the else if (isURL(input)) branch, in which it ignores the path property given and just glues pathname & search together.
Reading the document, it says url can be a string or a URL object also never mentions anything about search or pathname.
since I'm not providing a WHATWG URL object, I'm expecting to call this signature http.request(options[, callback]) retaining my path property as what v19 and before do.
Metadata
Metadata
Assignees
Labels
httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.