Skip to content

Commit

Permalink
make sure we use ipv4 first lookup for testing because we start serve…
Browse files Browse the repository at this point in the history
…r on 127.0.0.1
  • Loading branch information
Apollon77 committed Nov 25, 2023
1 parent a815186 commit 4549bbc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/01_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand All @@ -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);
Expand Down

0 comments on commit 4549bbc

Please sign in to comment.