diff options
Diffstat (limited to 'integration/bunjs-only-snippets/fetch.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/fetch.test.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/integration/bunjs-only-snippets/fetch.test.js b/integration/bunjs-only-snippets/fetch.test.js index 72b80cd35..76e09bcf8 100644 --- a/integration/bunjs-only-snippets/fetch.test.js +++ b/integration/bunjs-only-snippets/fetch.test.js @@ -1,4 +1,4 @@ -import { it, describe } from "bun:test"; +import { it, describe, expect } from "bun:test"; import fs from "fs"; describe("fetch", () => { @@ -20,3 +20,18 @@ describe("fetch", () => { }); } }); + +describe("Response", () => { + it("clone", async () => { + var body = new Response("<div>hello</div>", { + headers: { + "content-type": "text/html; charset=utf-8", + }, + }); + var clone = body.clone(); + body.headers.set("content-type", "text/plain"); + expect(clone.headers.get("content-type")).toBe("text/html; charset=utf-8"); + expect(body.headers.get("content-type")).toBe("text/plain"); + expect(await clone.text()).toBe("<div>hello</div>"); + }); +}); |