aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/node-http.test.ts
diff options
context:
space:
mode:
authorGravatar Derrick Farris <mr.dcfarris@gmail.com> 2023-03-03 23:08:26 -0600
committerGravatar GitHub <noreply@github.com> 2023-03-03 21:08:26 -0800
commit362684505177e8edf8f8231bfe2f824c8ab28090 (patch)
tree2d226461a2b94fd25770529b3eceb433e4de70ba /test/bun.js/node-http.test.ts
parentd8d23f259482c9c106f7f218b40d3545dae76b6a (diff)
downloadbun-362684505177e8edf8f8231bfe2f824c8ab28090.tar.gz
bun-362684505177e8edf8f8231bfe2f824c8ab28090.tar.zst
bun-362684505177e8edf8f8231bfe2f824c8ab28090.zip
fix(node:http): match Node headers casing (lowercase only) (#2288)
* fix(node:http): match Node headers casing (lowercase only) * fix(JSFetchHeaders): `WTFMove` the ascii string
Diffstat (limited to 'test/bun.js/node-http.test.ts')
-rw-r--r--test/bun.js/node-http.test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/bun.js/node-http.test.ts b/test/bun.js/node-http.test.ts
index e0964edb0..619d8cb35 100644
--- a/test/bun.js/node-http.test.ts
+++ b/test/bun.js/node-http.test.ts
@@ -101,6 +101,11 @@ describe("node:http", () => {
res.end("Not Found");
return;
}
+ if (reqUrl.pathname === "/lowerCaseHeaders") {
+ res.writeHead(200, { "content-type": "text/plain", "X-Custom-Header": "custom_value" });
+ res.end("Hello World");
+ return;
+ }
if (reqUrl.pathname.includes("timeout")) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
@@ -426,6 +431,16 @@ describe("node:http", () => {
req.end();
}
});
+
+ it("should return response with lowercase headers", done => {
+ const req = request(`http://localhost:${serverPort}/lowerCaseHeaders`, res => {
+ console.log(res.headers);
+ expect(res.headers["content-type"]).toBe("text/plain");
+ expect(res.headers["x-custom-header"]).toBe("custom_value");
+ done();
+ });
+ req.end();
+ });
});
describe("signal", () => {