Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Feb 3, 2025
1 parent 944636a commit 9b61e7d
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions tests/unit_node/http_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,11 @@ Deno.test(
});
request.on("close", () => resolve());
await promise;

if (Deno.build.os === "windows") {
// FIXME(kt3k): This is necessary for preventing op leak on windows
await new Promise((resolve) => setTimeout(resolve, 4000));
}
},
);

Expand Down Expand Up @@ -1887,27 +1892,3 @@ Deno.test("[node/http] an error with DNS propagates to request object", async ()
});
await promise;
});

Deno.test("[node/http] supports proxy http request", async () => {
const { promise, resolve } = Promise.withResolvers<void>();
const server = Deno.serve({ port: 0, onListen }, (req) => {
console.log("server received", req.url);
assertEquals(req.url, "http://example.com/");
return new Response("ok");
});

function onListen({ port }: { port: number }) {
http.request({
host: "localhost",
port,
path: "http://example.com",
}, async (res) => {
assertEquals(res.statusCode, 200);
assertEquals(await text(res), "ok");
resolve();
server.shutdown();
}).end();
}
await promise;
await server.finished;
});

0 comments on commit 9b61e7d

Please sign in to comment.