Skip to content

Commit

Permalink
fix: always show http protocol when https (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Oct 13, 2021
1 parent 3ccc1da commit e423a45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ function PluginInspect(options: Options = {}): Plugin {
// hijack httpServer.listen to print the log
const _listen = server.httpServer.listen
let port = config.server.port || 3000
const protocol = config.server.https ? 'https' : 'http'
let timer: any
server.httpServer.listen = function(this: any, ...args: any) {
port ||= args[0]
clearTimeout(timer)
timer = setTimeout(() => {
// eslint-disable-next-line no-console
console.log(` > Inspect: ${yellow(`http://localhost:${port}/__inspect/`)}\n`)
console.log(` > Inspect: ${yellow(`${protocol}://localhost:${port}/__inspect/`)}\n`)
}, 0)
return _listen.apply(this, args)
}
Expand Down

0 comments on commit e423a45

Please sign in to comment.