Closed mchen391 closed 4 years ago
url-parse
was designed to not throw errors like the legacy Node.js URL parser.
> url.parse('https://test.com:invalidport')
Url {
protocol: 'https:',
slashes: true,
auth: null,
host: 'test.com',
port: null,
hostname: 'test.com',
hash: null,
search: null,
query: null,
pathname: '/:invalidport',
path: '/:invalidport',
href: 'https://test.com/:invalidport'
}
The result is different in this case but both are wrong as the URL to parse is not a valid URL.
Got it. I would switch to node.js url parser instead. Thanks.
Version: 1.4.7 I noticed that
resulted in
with no error and the invalid port was included in "hostname".
I would expect either an error is thrown or at least the
port
field beinginvalidport
so that I can verify it only contains numbers.