Skip to content

Commit

Permalink
feat(server): enhance server.selfUrl format
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 24, 2024
1 parent 7c61fb2 commit 7984e91
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/src/index.ts
Expand Up @@ -143,7 +143,13 @@ export class Server extends KoaRouter {
get selfUrl() {
const wildcard = ['0.0.0.0', '::']
const host = wildcard.includes(this.host) ? '127.0.0.1' : this.host
return `http://${host}:${this.port}`
if (this.port === 80) {
return `http://${host}`
} else if (this.port === 443) {
return `https://${host}`
} else {
return `http://${host}:${this.port}`
}
}

/**
Expand Down

0 comments on commit 7984e91

Please sign in to comment.