diff options
Diffstat (limited to 'test/js/node/http/node-http.test.ts')
-rw-r--r-- | test/js/node/http/node-http.test.ts | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts index 619718fee..d28676a19 100644 --- a/test/js/node/http/node-http.test.ts +++ b/test/js/node/http/node-http.test.ts @@ -807,6 +807,8 @@ describe("node:http", () => { done(); } catch (error) { done(error); + } finally { + server.close(); } }); }); @@ -823,20 +825,12 @@ describe("node:http", () => { }); } catch (err) { done(err); + } finally { + server.close(); } }); }); - test("should not decompress gzip, issue#4397", async () => { - const { promise, resolve } = Promise.withResolvers(); - request("https://bun.sh/", { headers: { "accept-encoding": "gzip" } }, res => { - res.on("data", function cb(chunk) { - resolve(chunk); - res.off("data", cb); - }); - }).end(); - const chunk = await promise; - expect(chunk.toString()).not.toContain("<html"); - }); + test("test unix socket server", done => { const socketPath = `${tmpdir()}/bun-server-${Math.random().toString(32)}.sock`; const server = createServer((req, res) => { @@ -850,6 +844,18 @@ describe("node:http", () => { res.end(); }); + test("should not decompress gzip, issue#4397", async () => { + const { promise, resolve } = Promise.withResolvers(); + request("https://bun.sh/", { headers: { "accept-encoding": "gzip" } }, res => { + res.on("data", function cb(chunk) { + resolve(chunk); + res.off("data", cb); + }); + }).end(); + const chunk = await promise; + expect(chunk.toString()).not.toContain("<html"); + }); + server.listen(socketPath, () => { // TODO: unix socket is not implemented in fetch. const output = spawnSync("curl", ["--unix-socket", socketPath, "http://localhost/bun?a=1"]); @@ -858,6 +864,8 @@ describe("node:http", () => { done(); } catch (err) { done(err); + } finally { + server.close(); } }); }); |