Fix being unable to use [::] for the host

Fixes #1582.
This commit is contained in:
Asher 2020-09-30 12:02:31 -05:00
parent 8b5deac92b
commit 11eaf0b470
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 4 additions and 1 deletions

View File

@ -584,8 +584,11 @@ export class HttpServer {
const onListen = (): void => resolve(this.address())
if (this.options.socket) {
this.server.listen(this.options.socket, onListen)
} else if (this.options.host) {
// [] is the correct format when using :: but Node errors with them.
this.server.listen(this.options.port, this.options.host.replace(/^\[|\]$/g, ""), onListen)
} else {
this.server.listen(this.options.port, this.options.host, onListen)
this.server.listen(this.options.port, onListen)
}
})
}