Closed
Description
- Version: 8.8.1, but also occurs in 10.0.0
- Platform: MacOS
- Subsystem: url
Overriding the host property with a host that has port 80, will not override the port.
Example:
const {URL} = require('url')
const u = new URL('http://localhost:3000/foo')
u.host = 'some-domain:80'
console.log(u.href) // expected http://some-domain:80/foo, actual: http://some-domain:3000/foo
// note that any other port besides 80 works correctly:
const u2 = new URL('http://localhost:3000/foo')
u2.host = 'some-domain:801'
console.log(u2.href) // http://some-domain:801/foo
The same bug applies to https
with port 443.