aboutsummaryrefslogtreecommitdiff
path: root/test/js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js')
-rw-r--r--test/js/web/fetch/body.test.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/js/web/fetch/body.test.ts b/test/js/web/fetch/body.test.ts
index 40a70c5b3..fa3d4e53b 100644
--- a/test/js/web/fetch/body.test.ts
+++ b/test/js/web/fetch/body.test.ts
@@ -624,6 +624,45 @@ for (const { body, fn } of bodyTypes) {
});
}
});
+
+ describe("new Response()", () => {
+ ["text", "arrayBuffer", "blob"].map(method => {
+ test(method, async () => {
+ const result = new Response();
+ expect(result).toHaveProperty("bodyUsed", false);
+
+ // @ts-expect-error
+ await result[method]();
+ expect(result).toHaveProperty("bodyUsed", false);
+ });
+ });
+ });
+
+ describe('new Request(url, {method: "POST" })', () => {
+ ["text", "arrayBuffer", "blob"].map(method => {
+ test(method, async () => {
+ const result = new Request("https://example.com", { method: "POST" });
+ expect(result).toHaveProperty("bodyUsed", false);
+
+ // @ts-expect-error
+ await result[method]();
+ expect(result).toHaveProperty("bodyUsed", false);
+ });
+ });
+ });
+
+ describe("new Request(url)", () => {
+ ["text", "arrayBuffer", "blob"].map(method => {
+ test(method, async () => {
+ const result = new Request("https://example.com");
+ expect(result).toHaveProperty("bodyUsed", false);
+
+ // @ts-expect-error
+ await result[method]();
+ expect(result).toHaveProperty("bodyUsed", false);
+ });
+ });
+ });
});
}