File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { HttpCode } from "../../src/common/http"
6
6
import { proxy } from "../../src/node/proxy"
7
7
import * as httpserver from "../utils/httpserver"
8
8
import * as integration from "../utils/integration"
9
+ import { getAvailablePort } from "../utils/helpers"
9
10
10
11
describe ( "proxy" , ( ) => {
11
12
const nhooyrDevServer = new httpserver . HttpServer ( )
@@ -166,14 +167,16 @@ describe("proxy", () => {
166
167
// src/node/proxy.ts, you should probably add it to
167
168
// this test suite.
168
169
describe ( "proxy (standalone)" , ( ) => {
169
- const PORT = 9003
170
- const PROXY_PORT = 8003
171
- const URL = `http://localhost:${ PORT } `
172
- const PROXY_URL = `http://localhost:${ PROXY_PORT } `
170
+ let URL = ""
171
+ let PROXY_URL = ""
173
172
let testServer : http . Server
174
173
let proxyTarget : http . Server
175
174
176
175
beforeEach ( async ( ) => {
176
+ const PORT = await getAvailablePort ( )
177
+ const PROXY_PORT = await getAvailablePort ( )
178
+ URL = `http://localhost:${ PORT } `
179
+ PROXY_URL = `http://localhost:${ PROXY_PORT } `
177
180
// Define server and a proxy server
178
181
testServer = http . createServer ( ( req , res ) => {
179
182
proxy . web ( req , res , {
You can’t perform that action at this time.
0 commit comments