aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/fetch_headers.test.js
diff options
context:
space:
mode:
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) {