chore: fix net specs when rerunning locally (#22745)
This commit is contained in:
parent
f3fd40c221
commit
e58a35e5aa
1 changed files with 4 additions and 2 deletions
|
@ -60,8 +60,10 @@ function respondNTimes (fn: http.RequestListener, n: number): Promise<string> {
|
|||
const server = http.createServer((request, response) => {
|
||||
fn(request, response)
|
||||
// don't close if a redirect was returned
|
||||
n--
|
||||
if ((response.statusCode < 300 || response.statusCode >= 399) && n <= 0) { server.close() }
|
||||
if ((response.statusCode < 300 || response.statusCode >= 399) && n <= 0) {
|
||||
n--
|
||||
server.close()
|
||||
}
|
||||
})
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
resolve(`http://127.0.0.1:${(server.address() as AddressInfo).port}`)
|
||||
|
|
Loading…
Reference in a new issue