aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/fetch.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/fetch.test.js')
-rw-r--r--test/bun.js/fetch.test.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/bun.js/fetch.test.js b/test/bun.js/fetch.test.js
index ebcdcbc8b..d36932e42 100644
--- a/test/bun.js/fetch.test.js
+++ b/test/bun.js/fetch.test.js
@@ -8,6 +8,30 @@ const exampleFixture = fs.readFileSync(
"utf8",
);
+describe("Headers", () => {
+ it(".toJSON", () => {
+ var headers = new Headers({
+ "content-length": "123",
+ "content-type": "text/plain",
+ "x-another-custom-header": "Hello World",
+ "x-custom-header": "Hello World",
+ });
+ expect(JSON.stringify(headers.toJSON(), null, 2)).toBe(
+ JSON.stringify(Object.fromEntries(headers.entries()), null, 2),
+ );
+ });
+
+ it(".count", () => {
+ var headers = new Headers({
+ "content-length": "123",
+ "content-type": "text/plain",
+ "x-another-custom-header": "Hello World",
+ "x-custom-header": "Hello World",
+ });
+ expect(headers.count).toBe(4);
+ });
+});
+
describe("fetch", () => {
const urls = [
"https://example.com",