sindresorhus/normalize-url

Don't remove slash from protocol string

Closed this issue · 1 comments

I detected that the library internally is removing duplicate slashes:

https://github.com/sindresorhus/normalize-url/blob/master/index.js#L42

Some urls need to pass another url as argument (for example, when you use a HTTPS Proxy)

Current behavior

 node
> const normalizeUrl = require('normalize-url')
undefined
> normalizeUrl('https://foo.com/https://bar.com')
'https://foo.com/https:/bar.com' // not resoluble url :(

Expected behavior

 node
> const normalizeUrl = require('normalize-url')
undefined
> normalizeUrl('https://foo.com/https://bar.com')
'https://foo.com/https://bar.com'  // 🙌

Hey,

I have fixed the issue and can submit a PR if are interested in it. I have added the test for this particular case as well.