We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I try to parse a url which has a port but no protocol, node returns protocol as the host name as part of the url object.
url.parse('localhost:8080/api/user') returns
url.parse('localhost:8080/api/user')
{ protocol: 'localhost:', slashes: null, auth: null, host: '8080', port: null, hostname: '8080', hash: null, search: null, query: null, pathname: '/api/user', path: '/api/user', href: 'localhost:8080/api/user' }
Host, protocol and port all here messed up here.
The text was updated successfully, but these errors were encountered:
No, it's completely valid.
Sorry, something went wrong.
Url does not not necessary have http or https protocol.
http
https
In A:B/C/D, A: is the protocol, B is the host, /C/D/ is the path.
A:B/C/D
A:
B
/C/D/
@pawanrawal, I think a better way to explain might be:
According to RFC 2396, section 3.2. Authority Component:
3.2. Authority Component
The authority component is preceded by a double slash "//" and is terminated by the next slash "/", question-mark "?", or by the end of the URI.
...meaning it requires // to start the authority part- so in your example, it is considered the scheme.
//
No branches or pull requests
When I try to parse a url which has a port but no protocol, node returns protocol as the host name as part of the url object.
url.parse('localhost:8080/api/user')
returnsHost, protocol and port all here messed up here.
The text was updated successfully, but these errors were encountered: