diff options
Diffstat (limited to 'integration/bunjs-only-snippets/fetch.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/fetch.test.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/fetch.test.js b/integration/bunjs-only-snippets/fetch.test.js index b1ab57366..2f976fd83 100644 --- a/integration/bunjs-only-snippets/fetch.test.js +++ b/integration/bunjs-only-snippets/fetch.test.js @@ -376,6 +376,21 @@ describe("Response", () => { expect(await clone.text()).toBe("<div>hello</div>"); gc(); }); + it("invalid json", async () => { + gc(); + var body = new Response("<div>hello</div>", { + headers: { + "content-type": "text/html; charset=utf-8", + }, + }); + try { + await body.json(); + expect(false).toBe(true); + } catch (exception) { + expect(exception instanceof SyntaxError); + } + }); + testBlobInterface((data) => new Response(data), true); }); |