Closed
Description
- Version: I've tested it against Node.js 11, 12, 13, 14, 15
- Platform: I've tested it on macOS Big Sur.
- Subsystem:
What steps will reproduce the bug?
Create a new format.js
file with content below:
const url = require('url')
console.log(url.format({
protocol: 'http',
hostname: '[::]'
}))
Then run it with node format.js
.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
Should output http://[::]
instead.
What do you see instead?
It will output http://[[::]]
which I believe is wrong.
Additional information
- I know
url.format(urlobject)
was deprecated as per https://nodejs.org/api/url.html#url_url_format_urlobject, but there're still libraries using it. url.format(new URL('http://[::]'))
would outputhttp://[::]/
as I expected.