-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url.format
does not have same behavior for pathnames with and without slashes
#19523
Comments
@beck From what I understand looking at the code, adding missing
One solution is to take out the logic to add missing |
I'm not sure about this one... There are protocols that don't have slashes before pathname (e.g. mailto). I suppose we could check that hostname & pathname exist but given that the legacy url stuff is meant to be frozen, I don't know how I feel about it. |
👍I'm cool with this being labeled confirmed and wontfix. If anyone else stumbles upon this, this is the helper I used to give me the API I desired. |
@apapirovski @beck : Passing the protocol along is probably the safe thing to do. Given its the legacy stuff, I agree that probably it can be left as is. |
Another option is to use url.format({ slashes: true, hostname: 'dougbeck.com', pathname: 'womp.html' }) or |
Closing, let me know if it should stay open. |
Using Node@9.9 on OSX.
Problem
url.format
returns an usable result whenpathname
is not slash prefixed:Expectation
pathname
is treated the same with or without the leading / (slash)Conversation started here: nodejs/help#1176
The text was updated successfully, but these errors were encountered: