aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/fetch_headers.test.js
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/fetch_headers.test.js
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/fetch_headers.test.js')
-rw-r--r--test/bun.js/fetch_headers.test.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/bun.js/fetch_headers.test.js b/test/bun.js/fetch_headers.test.js
index 2e5b9fa52..cd2786c08 100644
--- a/test/bun.js/fetch_headers.test.js
+++ b/test/bun.js/fetch_headers.test.js
@@ -46,6 +46,18 @@ describe("Headers", async () => {
// This would hang
expect(await fetchContent({ "x-test": origString })).toBe(origString);
});
+
+ describe("toJSON()", () => {
+ it("should provide lowercase header names", () => {
+ const headers1 = new Headers({ "X-Test": "yep", "Content-Type": "application/json" });
+ expect(headers1.toJSON()).toEqual({ "x-test": "yep", "content-type": "application/json" });
+
+ const headers2 = new Headers();
+ headers2.append("X-Test", "yep");
+ headers2.append("Content-Type", "application/json");
+ expect(headers2.toJSON()).toEqual({ "x-test": "yep", "content-type": "application/json" });
+ });
+ });
});
async function fetchContent(headers) {