Currently parsed URL does not contain port when its value is the default for the specified protocol:
parse("http://localhost:80").port === ''
parse("https://localhost:443").port === ''
It would be great to have an option/parameter to keep the port number even if it is the default for the protocol.
This would be useful when default port is defined by the environment/application requirements and is different from the standard. For example, an application might want to interpret http://localhost as http://localhost:8080 and not http://localhost:80. Only http://localhost:80 will be interpreted as http://localhost:80. Right now after URL has been parsed there is no way to know if port was not specified or default port was specified.
I'd be glad to provide a PR for this. Not sure if it fine to just add a 4th parameter to the URL function.
P.S. thanks for this library, it is really convenient and simple to use!
Currently parsed URL does not contain port when its value is the default for the specified protocol:
It would be great to have an option/parameter to keep the port number even if it is the default for the protocol.
This would be useful when default port is defined by the environment/application requirements and is different from the standard. For example, an application might want to interpret
http://localhostashttp://localhost:8080and nothttp://localhost:80. Onlyhttp://localhost:80will be interpreted ashttp://localhost:80. Right now after URL has been parsed there is no way to know if port was not specified or default port was specified.I'd be glad to provide a PR for this. Not sure if it fine to just add a 4th parameter to the
URLfunction.P.S. thanks for this library, it is really convenient and simple to use!