-
Notifications
You must be signed in to change notification settings - Fork 7.3k
url + http/https: weird api between these module #8722
Comments
sorry, i mean |
any thoughts from core team? |
What node.js version are we talking about? |
Also, could you please paste a complete example of this thing, i.e. the code that works with |
From the latest stable docs:
the complete example should be written at https://github.com/yorkie/node-httpmocker/blob/master/index.js#L39, now i copy/paste it here: function mockRequest(options, callback) {
var requesturl = url.format(options);
// ...
} The function Hence that the progress is: calling To reproduce this on > url.format({protocol:'http',host:'github.com',path:'/induty'})
'http://github.com'
> url.format({protocol:'http',host:'github.com',pathname:'/induty'})
'http://github.com/induty' |
and this actually is not related |
Oh, I see. It doesn't look like there could be a reason why it should not support |
bingo, then would do that later 🍒 |
Fixed in d312b6d. |
this adds support for a "path" field that overrides "query", "search", and "pathname" if given. Fixes: nodejs/node-v0.x-archive#8722 PR-URL: nodejs/node-v0.x-archive#8755 Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
url.format
will return an object ownspathname
rather thanpath
, howeverhttp.request
andhttps.request
do acceptpath
rather thanpathname
.sometimes, we would seem to write our program:
path
is missing, yeah actually we can addurlobj.path = urlobj.pathname
for now, it does work as well, but it's a weird behavior in api level imo.I'm guessing we should unify these two/three functions definitely, of course backward compatible with
url
module.The text was updated successfully, but these errors were encountered: