aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-09-05 06:12:54 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-05 06:12:54 -0700
commit7dae4db52a403396bbe23ec6299f5a06d50e829b (patch)
tree50056ef0128beac5ce69a5b455fbc841399b122f /test
parentbcab2f9a0e6c59e18d96d886ae76a0086584c4bc (diff)
downloadbun-7dae4db52a403396bbe23ec6299f5a06d50e829b.tar.gz
bun-7dae4db52a403396bbe23ec6299f5a06d50e829b.tar.zst
bun-7dae4db52a403396bbe23ec6299f5a06d50e829b.zip
fix ipv6 localhost fetch (#4498)
* `node` null for localhost getaddrinfo * more test
Diffstat (limited to 'test')
-rw-r--r--test/js/web/fetch/fetch.test.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/js/web/fetch/fetch.test.ts b/test/js/web/fetch/fetch.test.ts
index 59847dde9..aa44ee76a 100644
--- a/test/js/web/fetch/fetch.test.ts
+++ b/test/js/web/fetch/fetch.test.ts
@@ -531,6 +531,26 @@ describe("fetch", () => {
expect(response2.status).toBe(200);
expect(await response2.text()).toBe("0");
});
+
+ it("should work with ipv6 localhost", async () => {
+ const server = Bun.serve({
+ port: 0,
+ fetch(req) {
+ return new Response("Pass!");
+ },
+ });
+
+ let res = await fetch(`http://[::1]:${server.port}`);
+ expect(await res.text()).toBe("Pass!");
+ res = await fetch(`http://[::]:${server.port}/`);
+ expect(await res.text()).toBe("Pass!");
+ res = await fetch(`http://[0:0:0:0:0:0:0:1]:${server.port}/`);
+ expect(await res.text()).toBe("Pass!");
+ res = await fetch(`http://[0000:0000:0000:0000:0000:0000:0000:0001]:${server.port}/`);
+ expect(await res.text()).toBe("Pass!");
+
+ server.stop();
+ });
});
it("simultaneous HTTPS fetch", async () => {