From 4549bbc133c62e1795f95d24e0285bf1349d8ade Mon Sep 17 00:00:00 2001 From: Ingo Fischer Date: Sat, 25 Nov 2023 18:59:20 +0100 Subject: [PATCH] make sure we use ipv4 first lookup for testing because we start server on 127.0.0.1 --- test/01_proxy.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/01_proxy.ts b/test/01_proxy.ts index 7061a6d..60b09a5 100644 --- a/test/01_proxy.ts +++ b/test/01_proxy.ts @@ -7,7 +7,8 @@ import http from "http"; import net from "net"; import nodeStatic from "node-static"; import WebSocket from "ws"; -import { Proxy } from "../lib/proxy"; +import { Proxy } from "../"; +import dns from "dns"; const fileStaticA = new nodeStatic.Server(`${__dirname}/wwwA`); const fileStaticB = new nodeStatic.Server(`${__dirname}/wwwB`); @@ -19,6 +20,10 @@ const testWSPort = 40007; const testUrlA = `http://${testHost}:${testPortA}`; const testUrlB = `http://${testHost}:${testPortB}`; +if (typeof dns.setDefaultResultOrder === "function") { + dns.setDefaultResultOrder("ipv4first"); +} + const getHttp = (url, cb) => { request({ url }, (err, resp, body) => { cb(err, resp, body);