| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 13cace1 commit 420e7f1
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ | |||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const http = require('http'); | |
| 6 | + const net = require('net'); | ||
| 6 | 7 | ||
| 7 | 8 | function explicit(req, res) { | |
| 8 | 9 | assert.throws(() => { | |
@@ -32,8 +33,10 @@ const server = http.createServer((req, res) => { | |||
| 32 | 33 | } else { | |
| 33 | 34 | implicit(req, res); | |
| 34 | 35 | } | |
| 35 | - }).listen(common.PORT, common.mustCall(() => { | ||
| 36 | - const url = `http://localhost:${common.PORT}`; | ||
| 36 | + }).listen(0, common.mustCall(() => { | ||
| 37 | + const addr = server.address().address; | ||
| 38 | + const hostname = net.isIPv6(addr) ? `[${addr}1]` : addr; | ||
| 39 | + const url = `http://${hostname}:${server.address().port}`; | ||
| 37 | 40 | let left = 2; | |
| 38 | 41 | const check = common.mustCall((res) => { | |
| 39 | 42 | left--; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments