This library doesnt seem to parse the host properly when there isnt a protocol. ``` > u.parse("www.google.com/yay?q=10&q=12") Url { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: '?q=10&q=12', query: 'q=10&q=12', pathname: 'www.google.com/yay', path: 'www.google.com/yay?q=10&q=12', href: 'www.google.com/yay?q=10&q=12' } ```
Activity
sc0Vu commentedon Mar 9, 2018
I met this too.
vv13 commentedon Sep 6, 2018
i judge protocol exists before parse:
hope it can help you .
ljharb commentedon Jan 27, 2021
What does node's core
urlmodule do here?(specifically, without a protocol, it's not actually a URL, so this might simply be user error)
ameshkin commentedon Jan 25, 2023
I have seen many cases of protocol less links such as //google.com which are annoying. Everyone should always just use SSL and https.
This library does not correctly handle these links well but you can use regex to look for //. I may fork and update this package.
ameshkin commentedon Jan 25, 2023
Without // , http or https, it's not a domain.
www.google.com/yay?q=10&q=12needs to have // instead of www.ljharb commentedon Jan 25, 2023
@ameshkin this library matches what node’s core url module does, so if that one doesn’t do it, this one shouldn’t either.