diff options
author | 2022-11-15 18:31:22 -0800 | |
---|---|---|
committer | 2022-11-15 18:31:22 -0800 | |
commit | 996e5dd235172bb14d286add7313306a8a8b772c (patch) | |
tree | 26c8cd4094f4c851c4da49388acba1232618d54e /test/bun.js/fetch.test.js | |
parent | 025749027bbb9aefe371a85277c8103dc80c6a06 (diff) | |
download | bun-996e5dd235172bb14d286add7313306a8a8b772c.tar.gz bun-996e5dd235172bb14d286add7313306a8a8b772c.tar.zst bun-996e5dd235172bb14d286add7313306a8a8b772c.zip |
Add test for non-standard Headers API additions
Diffstat (limited to 'test/bun.js/fetch.test.js')
-rw-r--r-- | test/bun.js/fetch.test.js | 24 |
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", |