mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
Compare commits
12 Commits
claude/add
...
ciro/fix-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
633c3fc922 | ||
|
|
05e55f8376 | ||
|
|
58b3b16e5f | ||
|
|
9674a4d329 | ||
|
|
02a308bcf6 | ||
|
|
850a2b8b58 | ||
|
|
982df60207 | ||
|
|
0c93971757 | ||
|
|
5d5e862c86 | ||
|
|
24c8c0a647 | ||
|
|
1dcce6b62e | ||
|
|
1abad17e75 |
@@ -200,12 +200,14 @@ const Handlers = struct {
|
||||
|
||||
pub fn resolvePromise(this: *Handlers, value: JSValue) void {
|
||||
const promise = this.promise.trySwap() orelse return;
|
||||
promise.asAnyPromise().?.resolve(this.globalObject, value);
|
||||
const anyPromise = promise.asAnyPromise() orelse return;
|
||||
anyPromise.resolve(this.globalObject, value);
|
||||
}
|
||||
|
||||
pub fn rejectPromise(this: *Handlers, value: JSValue) bool {
|
||||
const promise = this.promise.trySwap() orelse return false;
|
||||
promise.asAnyPromise().?.reject(this.globalObject, value);
|
||||
const anyPromise = promise.asAnyPromise() orelse return false;
|
||||
anyPromise.reject(this.globalObject, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2839,15 +2841,6 @@ fn NewSocket(comptime ssl: bool) type {
|
||||
.binary_type = this.handlers.binary_type,
|
||||
.is_server = is_server,
|
||||
};
|
||||
this.handlers.onOpen = .zero;
|
||||
this.handlers.onClose = .zero;
|
||||
this.handlers.onData = .zero;
|
||||
this.handlers.onWritable = .zero;
|
||||
this.handlers.onTimeout = .zero;
|
||||
this.handlers.onConnectError = .zero;
|
||||
this.handlers.onEnd = .zero;
|
||||
this.handlers.onError = .zero;
|
||||
this.handlers.onHandshake = .zero;
|
||||
raw.* = .{
|
||||
.handlers = raw_handlers_ptr,
|
||||
.this_value = .zero,
|
||||
@@ -2856,6 +2849,7 @@ fn NewSocket(comptime ssl: bool) type {
|
||||
.wrapped = .tcp,
|
||||
.protos = null,
|
||||
};
|
||||
raw_handlers_ptr.protect();
|
||||
|
||||
var raw_js_value = raw.getThisValue(globalObject);
|
||||
if (JSSocketType(ssl).dataGetCached(this.getThisValue(globalObject))) |raw_default_data| {
|
||||
@@ -2879,9 +2873,10 @@ fn NewSocket(comptime ssl: bool) type {
|
||||
if (this.reffer.has) {
|
||||
var vm = this.handlers.vm;
|
||||
this.reffer.unref(vm);
|
||||
old_context.deinit(ssl);
|
||||
bun.default_allocator.destroy(this.handlers);
|
||||
this.poll_ref.unref(vm);
|
||||
// will free handlers and the old_context when hits 0 active connections
|
||||
// the connection can be upgraded inside a handler call so we need to garantee that it will be still alive
|
||||
this.handlers.markInactive(ssl, old_context, this.wrapped);
|
||||
this.has_pending_activity.store(false, .Release);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ describe("Server", () => {
|
||||
port: 0,
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe("Hello");
|
||||
server.stop(true);
|
||||
});
|
||||
@@ -206,7 +206,7 @@ describe("Server", () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await fetch(`http://${server.hostname}:${server.port}`, { signal: abortController.signal });
|
||||
await fetch(server.url, { signal: abortController.signal });
|
||||
} catch {}
|
||||
expect(signalOnServer).toBe(true);
|
||||
server.stop(true);
|
||||
@@ -229,7 +229,7 @@ describe("Server", () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await fetch(`http://${server.hostname}:${server.port}`, { signal: abortController.signal });
|
||||
await fetch(server.url, { signal: abortController.signal });
|
||||
} catch {}
|
||||
expect(signalOnServer).toBe(false);
|
||||
server.stop(true);
|
||||
@@ -274,7 +274,7 @@ describe("Server", () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await fetch(`http://${server.hostname}:${server.port}`, { signal: abortController.signal });
|
||||
await fetch(server.url, { signal: abortController.signal });
|
||||
} catch {}
|
||||
await Bun.sleep(10);
|
||||
expect(signalOnServer).toBe(true);
|
||||
@@ -289,7 +289,7 @@ describe("Server", () => {
|
||||
},
|
||||
});
|
||||
try {
|
||||
const url = `http://${server.hostname}:${server.port}/`;
|
||||
const url = server.url.href;
|
||||
const response = await server.fetch(url);
|
||||
expect(await response.text()).toBe("Hello World!");
|
||||
expect(response.status).toBe(200);
|
||||
@@ -306,7 +306,7 @@ describe("Server", () => {
|
||||
},
|
||||
});
|
||||
try {
|
||||
const url = `http://${server.hostname}:${server.port}/`;
|
||||
const url = server.url.href;
|
||||
const response = await server.fetch(new Request(url));
|
||||
expect(await response.text()).toBe("Hello World!");
|
||||
expect(response.status).toBe(200);
|
||||
@@ -352,7 +352,7 @@ describe("Server", () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await fetch(`http://${server.hostname}:${server.port}`, { signal: abortController.signal });
|
||||
await fetch(server.url, { signal: abortController.signal });
|
||||
} catch {}
|
||||
await Bun.sleep(10);
|
||||
expect(signalOnServer).toBe(true);
|
||||
@@ -391,18 +391,18 @@ describe("Server", () => {
|
||||
},
|
||||
port: 0,
|
||||
});
|
||||
const url = `${server.hostname}:${server.port}`;
|
||||
const url = server.url.href.replace("https", "http");
|
||||
|
||||
try {
|
||||
// should fail
|
||||
await fetch(`http://${url}`, { tls: { rejectUnauthorized: false } });
|
||||
await fetch(url, { tls: { rejectUnauthorized: false } });
|
||||
expect(true).toBe(false);
|
||||
} catch (err: any) {
|
||||
expect(err.code).toBe("ConnectionClosed");
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await fetch(`https://${url}`, { tls: { rejectUnauthorized: false } }).then(res => res.text());
|
||||
const result = await fetch(server.url, { tls: { rejectUnauthorized: false } }).then(res => res.text());
|
||||
expect(result).toBe("Hello");
|
||||
} finally {
|
||||
server.stop(true);
|
||||
|
||||
@@ -19,7 +19,7 @@ test("uploads roundtrip", async () => {
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -51,7 +51,7 @@ test("formData uploads roundtrip, with a call to .body", async () => {
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -91,7 +91,7 @@ test("req.formData throws error when stream is in use", async () => {
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -117,7 +117,7 @@ test("formData uploads roundtrip, without a call to .body", async () => {
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -150,7 +150,7 @@ test("uploads roundtrip with sendfile()", async () => {
|
||||
},
|
||||
});
|
||||
|
||||
const resp = await fetch("http://" + server.hostname + ":" + server.port, {
|
||||
const resp = await fetch(server.url, {
|
||||
body: Bun.file(path),
|
||||
method: "PUT",
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ afterAll(() => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(Number(statusCode));
|
||||
expect(await response.text()).toBe("Foo Bar");
|
||||
},
|
||||
@@ -71,7 +71,7 @@ afterAll(() => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(500);
|
||||
expect(await response.text()).toBe("Error!");
|
||||
},
|
||||
@@ -88,7 +88,7 @@ it("should display a welcome message when the response value type is incorrect",
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
const text = await response.text();
|
||||
expect(text).toContain("Welcome to Bun!");
|
||||
},
|
||||
@@ -112,7 +112,7 @@ it("request.signal works in trivial case", async () => {
|
||||
},
|
||||
async server => {
|
||||
try {
|
||||
await fetch(`http://${server.hostname}:${server.port}`, { signal: aborty.signal });
|
||||
await fetch(server.url, { signal: aborty.signal });
|
||||
throw new Error("Expected fetch to throw");
|
||||
} catch (e: any) {
|
||||
expect(e.name).toBe("AbortError");
|
||||
@@ -142,9 +142,7 @@ it("request.signal works in leaky case", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
expect(async () => fetch(`http://${server.hostname}:${server.port}`, { signal: aborty.signal })).toThrow(
|
||||
"The operation was aborted.",
|
||||
);
|
||||
expect(async () => fetch(server.url, { signal: aborty.signal })).toThrow("The operation was aborted.");
|
||||
|
||||
await Bun.sleep(1);
|
||||
|
||||
@@ -163,7 +161,7 @@ it("should work for a file", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -200,7 +198,7 @@ it("request.url should be based on the Host header", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const expected = `http://${server.hostname}:${server.port}/helloooo`;
|
||||
const expected = `${server.url.href}/helloooo`;
|
||||
const response = await fetch(expected, {
|
||||
headers: {
|
||||
Host: "example.com",
|
||||
@@ -240,7 +238,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(402);
|
||||
expect(response.headers.get("I-AM")).toBe("A-TEAPOT");
|
||||
expect(await response.text()).toBe("");
|
||||
@@ -270,7 +268,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
// connection terminated
|
||||
expect(await response.text()).toBe("");
|
||||
expect(response.status).toBe(options.status ?? 200);
|
||||
@@ -325,7 +323,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
const text = await response.text();
|
||||
expect(text.length).toBe(textToExpect.length);
|
||||
expect(text).toBe(textToExpect);
|
||||
@@ -350,7 +348,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -377,7 +375,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(200);
|
||||
expect(await response.text()).toBe("Test Passed");
|
||||
},
|
||||
@@ -408,7 +406,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(500);
|
||||
},
|
||||
);
|
||||
@@ -435,7 +433,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(500);
|
||||
expect(await response.text()).toBe("Fail");
|
||||
expect(pass).toBe(true);
|
||||
@@ -466,7 +464,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -489,7 +487,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
const text = await response.text();
|
||||
expect(text).toBe(textToExpect);
|
||||
},
|
||||
@@ -517,7 +515,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -553,7 +551,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
count++;
|
||||
},
|
||||
@@ -582,7 +580,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -612,7 +610,7 @@ describe("streaming", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -627,7 +625,7 @@ it("should work for a hello world", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe("Hello, world!");
|
||||
},
|
||||
);
|
||||
@@ -643,7 +641,7 @@ it("should work for a blob", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -659,7 +657,7 @@ it("should work for a blob stream", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -675,7 +673,7 @@ it("should work for a file stream", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
},
|
||||
);
|
||||
@@ -695,7 +693,7 @@ it("fetch should work with headers", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const response = await fetch(server.url, {
|
||||
headers: {
|
||||
"X-Foo": "bar",
|
||||
},
|
||||
@@ -717,7 +715,7 @@ it(`should work for a file ${count} times serial`, async () => {
|
||||
},
|
||||
async server => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
}
|
||||
},
|
||||
@@ -734,7 +732,7 @@ it(`should work for ArrayBuffer ${count} times serial`, async () => {
|
||||
},
|
||||
async server => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe(textToExpect);
|
||||
}
|
||||
},
|
||||
@@ -753,11 +751,11 @@ describe("parallel", () => {
|
||||
async server => {
|
||||
for (let i = 0; i < count; ) {
|
||||
let responses = await Promise.all([
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
]);
|
||||
|
||||
for (let response of responses) {
|
||||
@@ -779,11 +777,11 @@ describe("parallel", () => {
|
||||
async server => {
|
||||
for (let i = 0; i < count; ) {
|
||||
let responses = await Promise.all([
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(`http://${server.hostname}:${server.port}`),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
fetch(server.url),
|
||||
]);
|
||||
|
||||
for (let response of responses) {
|
||||
@@ -804,10 +802,10 @@ it("should support reloading", async () => {
|
||||
fetch: first,
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe("first");
|
||||
server.reload({ fetch: second });
|
||||
const response2 = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response2 = await fetch(server.url);
|
||||
expect(await response2.text()).toBe("second");
|
||||
},
|
||||
);
|
||||
@@ -885,7 +883,7 @@ describe("status code text", () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.status).toBe(parseInt(code));
|
||||
expect(response.statusText).toBe(fixture[code]);
|
||||
},
|
||||
@@ -908,7 +906,7 @@ it("should support multiple Set-Cookie headers", async () => {
|
||||
},
|
||||
},
|
||||
async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
const response = await fetch(server.url);
|
||||
expect(response.headers.getAll("Set-Cookie")).toEqual(["foo=bar", "baz=qux"]);
|
||||
expect(response.headers.get("Set-Cookie")).toEqual("foo=bar, baz=qux");
|
||||
|
||||
@@ -964,7 +962,7 @@ describe("should support Content-Range with Bun.file()", () => {
|
||||
for (const [start, end] of good) {
|
||||
it(`good range: ${start} - ${end}`, async () => {
|
||||
await getServer(async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/?start=${start}&end=${end}`, {
|
||||
const response = await fetch(`${server.url.href}/?start=${start}&end=${end}`, {
|
||||
verbose: true,
|
||||
});
|
||||
expect(await response.arrayBuffer()).toEqual(full.buffer.slice(start, end));
|
||||
@@ -988,7 +986,7 @@ describe("should support Content-Range with Bun.file()", () => {
|
||||
for (const [start, end] of emptyRanges) {
|
||||
it(`empty range: ${start} - ${end}`, async () => {
|
||||
await getServer(async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/?start=${start}&end=${end}`);
|
||||
const response = await fetch(`${server.url.href}/?start=${start}&end=${end}`);
|
||||
const out = await response.arrayBuffer();
|
||||
expect(out).toEqual(new ArrayBuffer(0));
|
||||
expect(response.status).toBe(206);
|
||||
@@ -1010,7 +1008,7 @@ describe("should support Content-Range with Bun.file()", () => {
|
||||
for (const [start, end] of badRanges) {
|
||||
it(`bad range: ${start} - ${end}`, async () => {
|
||||
await getServer(async server => {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/?start=${start}&end=${end}`);
|
||||
const response = await fetch(`${server.url.href}/?start=${start}&end=${end}`);
|
||||
const out = await response.arrayBuffer();
|
||||
expect(out).toEqual(new ArrayBuffer(0));
|
||||
expect(response.status).toBe(206);
|
||||
@@ -1051,7 +1049,7 @@ it("request body and signal life cycle", async () => {
|
||||
const requests = [];
|
||||
for (let j = 0; j < 10; j++) {
|
||||
for (let i = 0; i < 250; i++) {
|
||||
requests.push(fetch(`http://${server.hostname}:${server.port}`));
|
||||
requests.push(fetch(server.url));
|
||||
}
|
||||
|
||||
await Promise.all(requests);
|
||||
@@ -1084,7 +1082,7 @@ it("propagates content-type from a Bun.file()'s file path in fetch()", async ()
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -1109,7 +1107,7 @@ it("does propagate type for Blob", async () => {
|
||||
|
||||
const body = new Blob(["hey"], { type: "text/plain;charset=utf-8" });
|
||||
// @ts-ignore
|
||||
const res = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const res = await fetch(server.url, {
|
||||
body,
|
||||
method: "POST",
|
||||
});
|
||||
@@ -1175,7 +1173,7 @@ it("#5859 text", async () => {
|
||||
},
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const response = await fetch(server.url, {
|
||||
method: "POST",
|
||||
body: new Uint8Array([0xfd]),
|
||||
});
|
||||
@@ -1198,7 +1196,7 @@ it("#5859 json", async () => {
|
||||
},
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const response = await fetch(server.url, {
|
||||
method: "POST",
|
||||
body: new Uint8Array([0xfd]),
|
||||
});
|
||||
@@ -1222,7 +1220,7 @@ it("server.requestIP (v4)", async () => {
|
||||
hostname: "127.0.0.1",
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`).then(x => x.json());
|
||||
const response = await fetch(server.url).then(x => x.json());
|
||||
expect(response).toEqual({
|
||||
address: "127.0.0.1",
|
||||
family: "IPv4",
|
||||
@@ -1287,7 +1285,7 @@ it("should response with HTTP 413 when request body is larger than maxRequestBod
|
||||
});
|
||||
|
||||
{
|
||||
const resp = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const resp = await fetch(server.url, {
|
||||
method: "POST",
|
||||
body: "A".repeat(10),
|
||||
});
|
||||
@@ -1295,7 +1293,7 @@ it("should response with HTTP 413 when request body is larger than maxRequestBod
|
||||
expect(await resp.text()).toBe("OK");
|
||||
}
|
||||
{
|
||||
const resp = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const resp = await fetch(server.url, {
|
||||
method: "POST",
|
||||
body: "A".repeat(11),
|
||||
});
|
||||
|
||||
@@ -475,7 +475,7 @@ describe("errors", () => {
|
||||
return new Response(result);
|
||||
},
|
||||
});
|
||||
const { default: text } = await import(`http://${server.hostname}:${server.port}/hey.txt`);
|
||||
const { default: text } = await import(`${server.url.href}/hey.txt`);
|
||||
expect(text).toBe(result);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -258,7 +258,7 @@ describe("async context passes through", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const response = await fetch("http://" + server.hostname + ":" + server.port);
|
||||
const response = await fetch(server.url);
|
||||
expect(await response.text()).toBe("value");
|
||||
|
||||
expect(s.getStore()).toBe("value");
|
||||
|
||||
@@ -18,7 +18,7 @@ it("fetch() with a buffered gzip response works (one chunk)", async () => {
|
||||
});
|
||||
gcTick(true);
|
||||
|
||||
const res = await fetch(`http://${server.hostname}:${server.port}`, { verbose: true });
|
||||
const res = await fetch(server.url, { verbose: true });
|
||||
gcTick(true);
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
const clone = new Buffer(arrayBuffer);
|
||||
@@ -49,7 +49,7 @@ it("fetch() with a redirect that returns a buffered gzip response works (one chu
|
||||
},
|
||||
});
|
||||
|
||||
const res = await fetch(`http://${server.hostname}:${server.port}/hey`, { verbose: true });
|
||||
const res = await fetch(`${server.url.href}/hey`, { verbose: true });
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
expect(
|
||||
new Buffer(arrayBuffer).equals(new Buffer(await Bun.file(import.meta.dir + "/fixture.html").arrayBuffer())),
|
||||
@@ -70,12 +70,12 @@ it("fetch() with a protocol-relative redirect that returns a buffered gzip respo
|
||||
},
|
||||
});
|
||||
|
||||
return Response.redirect(`://${server.hostname}:${server.port}/redirect`);
|
||||
return Response.redirect(`${server.url.href}/redirect`);
|
||||
},
|
||||
});
|
||||
|
||||
const res = await fetch(`http://${server.hostname}:${server.port}/hey`, { verbose: true });
|
||||
expect(res.url).toBe(`http://${server.hostname}:${server.port}/redirect`);
|
||||
const res = await fetch(`${server.url.href}/hey`, { verbose: true });
|
||||
expect(res.url).toBe(`${server.url.href}/redirect`);
|
||||
expect(res.redirected).toBe(true);
|
||||
expect(res.status).toBe(200);
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
@@ -113,7 +113,7 @@ it("fetch() with a gzip response works (one chunk, streamed, with a delay)", asy
|
||||
},
|
||||
});
|
||||
|
||||
const res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
const res = await fetch(server.url, {});
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
expect(
|
||||
new Buffer(arrayBuffer).equals(new Buffer(await Bun.file(import.meta.dir + "/fixture.html").arrayBuffer())),
|
||||
|
||||
@@ -18,7 +18,7 @@ describe("fetch doesn't leak", () => {
|
||||
const proc = Bun.spawn({
|
||||
env: {
|
||||
...bunEnv,
|
||||
SERVER: `http://${server.hostname}:${server.port}`,
|
||||
SERVER: server.url,
|
||||
COUNT: "200",
|
||||
},
|
||||
stderr: "inherit",
|
||||
@@ -64,7 +64,7 @@ describe("fetch doesn't leak", () => {
|
||||
|
||||
const env = {
|
||||
...bunEnv,
|
||||
SERVER: `${tls ? "https" : "http"}://${server.hostname}:${server.port}`,
|
||||
SERVER: server.url,
|
||||
BUN_JSC_forceRAMSize: (1024 * 1024 * 64).toString("10"),
|
||||
};
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
try {
|
||||
const res = await fetch(server_url, { signal: AbortSignal.timeout(20) });
|
||||
const reader = res.body?.getReader();
|
||||
@@ -101,7 +101,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
const res = await fetch(server_url);
|
||||
try {
|
||||
const promise = res.text(); // start buffering
|
||||
@@ -147,7 +147,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
const res = await fetch(server_url);
|
||||
try {
|
||||
const body = res.body as ReadableStream<Uint8Array>;
|
||||
@@ -278,7 +278,7 @@ describe("fetch() with streaming", () => {
|
||||
});
|
||||
|
||||
async function getReader() {
|
||||
return (await fetch(`http://${server.hostname}:${server.port}`, {})).body?.getReader();
|
||||
return (await fetch(server.url, {})).body?.getReader();
|
||||
}
|
||||
gcTick(false);
|
||||
const reader = await getReader();
|
||||
@@ -349,7 +349,7 @@ describe("fetch() with streaming", () => {
|
||||
return parseInt(match[1]?.trim(), 10);
|
||||
}
|
||||
|
||||
const res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
const res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
gcTick(false);
|
||||
@@ -411,7 +411,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
async function doRequest() {
|
||||
await Bun.sleep(10);
|
||||
const res = await fetch(server_url);
|
||||
@@ -478,7 +478,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
const res = await fetch(server_url);
|
||||
|
||||
const transform = new TransformStream({
|
||||
@@ -524,7 +524,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
const res = await fetch(server_url);
|
||||
|
||||
const reader = res.body?.getReader();
|
||||
@@ -601,7 +601,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
let res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
let res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
|
||||
@@ -672,7 +672,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const server_url = `http://${server.hostname}:${server.port}`;
|
||||
const server_url = server.url;
|
||||
const res = await fetch(server_url);
|
||||
const reader = res.body?.getReader();
|
||||
let buffer = Buffer.alloc(0);
|
||||
@@ -759,7 +759,7 @@ describe("fetch() with streaming", () => {
|
||||
},
|
||||
});
|
||||
|
||||
let res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
let res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
|
||||
@@ -810,13 +810,13 @@ describe("fetch() with streaming", () => {
|
||||
);
|
||||
},
|
||||
});
|
||||
let res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
let res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const result = await res.text();
|
||||
gcTick(false);
|
||||
expect(result).toBe(content);
|
||||
|
||||
res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
|
||||
@@ -881,13 +881,13 @@ describe("fetch() with streaming", () => {
|
||||
);
|
||||
},
|
||||
});
|
||||
let res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
let res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const result = await res.text();
|
||||
gcTick(false);
|
||||
expect(result).toBe(content);
|
||||
|
||||
res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
|
||||
@@ -931,13 +931,13 @@ describe("fetch() with streaming", () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
let res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
let res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const result = await res.text();
|
||||
gcTick(false);
|
||||
expect(result).toBe(content);
|
||||
|
||||
res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
|
||||
@@ -981,13 +981,13 @@ describe("fetch() with streaming", () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
let res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
let res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const result = await res.text();
|
||||
gcTick(false);
|
||||
expect(result).toBe(content);
|
||||
|
||||
res = await fetch(`http://${server.hostname}:${server.port}`, {});
|
||||
res = await fetch(server.url, {});
|
||||
gcTick(false);
|
||||
const reader = res.body?.getReader();
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ describe("Headers", () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
const result = await fetch(`http://${server.hostname}:${server.port}/`);
|
||||
const result = await fetch(server.url);
|
||||
const value = result.headers.get("content-encoding");
|
||||
const body = await result.json();
|
||||
expect(value).toBe("gzip");
|
||||
@@ -501,7 +501,7 @@ describe("fetch", () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const response = await fetch(server.url, {
|
||||
redirect: "manual",
|
||||
});
|
||||
expect(response.status).toBe(302);
|
||||
@@ -520,7 +520,7 @@ describe("fetch", () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const response = await fetch(server.url, {
|
||||
redirect: "follow",
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
@@ -540,7 +540,7 @@ describe("fetch", () => {
|
||||
},
|
||||
});
|
||||
try {
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`, {
|
||||
const response = await fetch(server.url, {
|
||||
redirect: "error",
|
||||
});
|
||||
expect(response).toBeUndefined();
|
||||
@@ -558,7 +558,7 @@ describe("fetch", () => {
|
||||
});
|
||||
|
||||
// POST with body
|
||||
const url = `http://${server.hostname}:${server.port}`;
|
||||
const url = server.url;
|
||||
const response = await fetch(url, { method: "POST", body: "buntastic" });
|
||||
expect(response.status).toBe(200);
|
||||
expect(await response.text()).toBe("buntastic");
|
||||
@@ -566,7 +566,7 @@ describe("fetch", () => {
|
||||
|
||||
["GET", "HEAD", "OPTIONS"].forEach(method =>
|
||||
it(`fail on ${method} with body`, async () => {
|
||||
const url = `http://${server.hostname}:${server.port}`;
|
||||
const url = server.url;
|
||||
expect(async () => {
|
||||
await fetch(url, { body: "buntastic" });
|
||||
}).toThrow("fetch() request with GET/HEAD/OPTIONS method cannot have body.");
|
||||
@@ -582,7 +582,7 @@ describe("fetch", () => {
|
||||
});
|
||||
|
||||
// POST with body
|
||||
const url = `http://${server.hostname}:${server.port}`;
|
||||
const url = server.url;
|
||||
const response = await fetch(url, { method: "POST", body: "buntastic" });
|
||||
expect(response.status).toBe(200);
|
||||
expect(await response.text()).toBe("9");
|
||||
@@ -1542,7 +1542,7 @@ describe("should strip headers", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const { headers, url, redirected } = await fetch(`http://${server.hostname}:${server.port}/redirect`, {
|
||||
const { headers, url, redirected } = await fetch(`${server.url.href}/redirect`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"I-Am-Here": "yes",
|
||||
@@ -1584,7 +1584,7 @@ describe("should strip headers", () => {
|
||||
return new Response("hello", {
|
||||
headers: {
|
||||
...request.headers,
|
||||
"Location": `http://${server.hostname}:${server.port}/redirected`,
|
||||
"Location": `${server.url.href}/redirected`,
|
||||
},
|
||||
status: 302,
|
||||
});
|
||||
@@ -1619,7 +1619,7 @@ it("same-origin status code 302 should not strip headers", async () => {
|
||||
return new Response("hello", {
|
||||
headers: {
|
||||
...request.headers,
|
||||
"Location": `http://${server.hostname}:${server.port}/redirected`,
|
||||
"Location": `${server.url.href}/redirected`,
|
||||
},
|
||||
status: 302,
|
||||
});
|
||||
@@ -1631,7 +1631,7 @@ it("same-origin status code 302 should not strip headers", async () => {
|
||||
},
|
||||
});
|
||||
|
||||
const { headers, url, redirected } = await fetch(`http://${server.hostname}:${server.port}/redirect`, {
|
||||
const { headers, url, redirected } = await fetch(`${server.url.href}/redirect`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Authorization": "yes",
|
||||
@@ -1695,8 +1695,9 @@ describe("should handle relative location in the redirect, issue#5635", () => {
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const resp = await fetch(`http://${server.hostname}:${server.port}${pathname}`);
|
||||
let url = new URL(server.url.href);
|
||||
url.pathname = pathname;
|
||||
const resp = await fetch(url);
|
||||
expect(resp.redirected).toBe(true);
|
||||
expect(new URL(resp.url).pathname).toStrictEqual(expected);
|
||||
expect(resp.status).toBe(200);
|
||||
@@ -1727,7 +1728,7 @@ it("should throw RedirectURLTooLong when location is too long", async () => {
|
||||
let err = undefined;
|
||||
try {
|
||||
gc();
|
||||
const resp = await fetch(`http://${server.hostname}:${server.port}/redirect`);
|
||||
const resp = await fetch(`${server.url.href}/redirect`);
|
||||
} catch (error) {
|
||||
gc();
|
||||
err = error;
|
||||
@@ -1755,7 +1756,7 @@ it("304 not modified with missing content-length does not cause a request timeou
|
||||
hostname: "localhost",
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/`);
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
expect(response.status).toBe(304);
|
||||
expect(await response.arrayBuffer()).toHaveLength(0);
|
||||
server.stop(true);
|
||||
@@ -1778,7 +1779,7 @@ it("304 not modified with missing content-length and connection close does not c
|
||||
hostname: "localhost",
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/`);
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
expect(response.status).toBe(304);
|
||||
expect(await response.arrayBuffer()).toHaveLength(0);
|
||||
server.stop(true);
|
||||
@@ -1801,7 +1802,7 @@ it("304 not modified with content-length 0 and connection close does not cause a
|
||||
hostname: "localhost",
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/`);
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
expect(response.status).toBe(304);
|
||||
expect(await response.arrayBuffer()).toHaveLength(0);
|
||||
server.stop(true);
|
||||
@@ -1824,7 +1825,7 @@ it("304 not modified with 0 content-length does not cause a request timeout", as
|
||||
hostname: "localhost",
|
||||
});
|
||||
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}/`);
|
||||
const response = await fetch(`http://${server.hostname}:${server.port}`);
|
||||
expect(response.status).toBe(304);
|
||||
expect(await response.arrayBuffer()).toHaveLength(0);
|
||||
server.stop(true);
|
||||
|
||||
@@ -12,7 +12,7 @@ describe("Headers", async () => {
|
||||
},
|
||||
port: 0,
|
||||
});
|
||||
url = `http://${server.hostname}:${server.port}`;
|
||||
url = server.url;
|
||||
});
|
||||
afterAll(() => {
|
||||
server.stop(true);
|
||||
|
||||
@@ -311,7 +311,7 @@ describe("FormData", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body: '--foo\r\nContent-Disposition: form-data; name="foo"; filename="bar"\r\n\r\nbaz\r\n--foo--\r\n\r\n',
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data; boundary=foo",
|
||||
@@ -335,7 +335,7 @@ describe("FormData", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const reqBody = new Request(`http://${server.hostname}:${server.port}`, {
|
||||
const reqBody = new Request(server.url, {
|
||||
body: '--foo\r\nContent-Disposition: form-data; name="foo"; filename="bar"\r\n\r\nbaz\r\n--foo--\r\n\r\n',
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data; boundary=foo",
|
||||
@@ -379,7 +379,7 @@ describe("FormData", () => {
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody: FetchURLArgs = [
|
||||
`http://${server.hostname}:${server.port}`,
|
||||
server.url,
|
||||
{
|
||||
body: form,
|
||||
headers,
|
||||
@@ -412,7 +412,7 @@ describe("FormData", () => {
|
||||
form.append("bar", "baz");
|
||||
|
||||
const reqBody = [
|
||||
`http://${server.hostname}:${server.port}`,
|
||||
server.url,
|
||||
{
|
||||
body: form,
|
||||
|
||||
@@ -448,7 +448,7 @@ describe("FormData", () => {
|
||||
|
||||
// @ts-ignore
|
||||
const reqBody = [
|
||||
`http://${server.hostname}:${server.port}`,
|
||||
server.url,
|
||||
{
|
||||
body: form,
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("WebSocket", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
const ws = new WebSocket(`ws://${server.hostname}:${server.port}`, {});
|
||||
const ws = new WebSocket(server.url.href.replace("http:", "ws:"), {});
|
||||
await new Promise(resolve => {
|
||||
ws.onopen = resolve;
|
||||
});
|
||||
@@ -274,7 +274,7 @@ describe("WebSocket", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
new WebSocket(`http://${server.hostname}:${server.port}`, {});
|
||||
new WebSocket(server.url, {});
|
||||
});
|
||||
describe("nodebuffer", () => {
|
||||
it("should support 'nodebuffer' binaryType", done => {
|
||||
@@ -293,7 +293,7 @@ describe("WebSocket", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
const ws = new WebSocket(`http://${server.hostname}:${server.port}`, {});
|
||||
const ws = new WebSocket(server.url, {});
|
||||
ws.binaryType = "nodebuffer";
|
||||
expect(ws.binaryType).toBe("nodebuffer");
|
||||
Bun.gc(true);
|
||||
@@ -331,7 +331,7 @@ describe("WebSocket", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
client = new WebSocket(`http://${server.hostname}:${server.port}`, {});
|
||||
client = new WebSocket(server.url, {});
|
||||
client.binaryType = "nodebuffer";
|
||||
expect(client.binaryType).toBe("nodebuffer");
|
||||
});
|
||||
@@ -420,7 +420,7 @@ describe("websocket in subprocess", () => {
|
||||
},
|
||||
});
|
||||
const subprocess = Bun.spawn({
|
||||
cmd: [bunExe(), import.meta.dir + "/websocket-subprocess.ts", `http://${server.hostname}:${server.port}`],
|
||||
cmd: [bunExe(), import.meta.dir + "/websocket-subprocess.ts", server.url.href],
|
||||
stderr: "pipe",
|
||||
stdin: "pipe",
|
||||
stdout: "pipe",
|
||||
@@ -484,7 +484,7 @@ describe("websocket in subprocess", () => {
|
||||
},
|
||||
});
|
||||
const subprocess = Bun.spawn({
|
||||
cmd: [bunExe(), import.meta.dir + "/websocket-subprocess.ts", `http://${server.hostname}:${server.port}`],
|
||||
cmd: [bunExe(), import.meta.dir + "/websocket-subprocess.ts", server.url.href],
|
||||
stderr: "pipe",
|
||||
stdin: "pipe",
|
||||
stdout: "pipe",
|
||||
@@ -514,7 +514,7 @@ describe("websocket in subprocess", () => {
|
||||
});
|
||||
|
||||
const subprocess = Bun.spawn({
|
||||
cmd: [bunExe(), import.meta.dir + "/websocket-subprocess.ts", `http://${server.hostname}:${server.port}`],
|
||||
cmd: [bunExe(), import.meta.dir + "/websocket-subprocess.ts", server.url.href],
|
||||
stderr: "pipe",
|
||||
stdin: "pipe",
|
||||
stdout: "pipe",
|
||||
|
||||
Reference in New Issue
Block a user