aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-10-15 21:34:05 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-10-15 21:34:05 -0700
commitc06bba77d46fc5fcdb2ca21591cbf94b8fa4e6ba (patch)
tree215bc35017d81ed455b15d3f62396f685bc94cc9
parent4ba217bc42e7f4d70487266c93dca9785bf23159 (diff)
downloadbun-c06bba77d46fc5fcdb2ca21591cbf94b8fa4e6ba.tar.gz
bun-c06bba77d46fc5fcdb2ca21591cbf94b8fa4e6ba.tar.zst
bun-c06bba77d46fc5fcdb2ca21591cbf94b8fa4e6ba.zip
Add test for body mixin error
-rw-r--r--test/bun.js/body-mixin-errors.test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/bun.js/body-mixin-errors.test.ts b/test/bun.js/body-mixin-errors.test.ts
new file mode 100644
index 000000000..cec812c3f
--- /dev/null
+++ b/test/bun.js/body-mixin-errors.test.ts
@@ -0,0 +1,17 @@
+import { it, describe, expect } from "bun:test";
+
+describe("body-mixin-errors", () => {
+ it("should fail when bodyUsed", async () => {
+ var res = new Response("a");
+ expect(res.bodyUsed).toBe(false);
+ await res.text();
+ expect(res.bodyUsed).toBe(true);
+
+ try {
+ await res.text();
+ throw new Error("should not get here");
+ } catch (e) {
+ expect(e.message).toBe("Body already used");
+ }
+ });
+});