summaryrefslogtreecommitdiff
path: root/cli/tests/unit/fetch_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r--cli/tests/unit/fetch_test.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts
index bafb23c2a..a92a7a051 100644
--- a/cli/tests/unit/fetch_test.ts
+++ b/cli/tests/unit/fetch_test.ts
@@ -1893,3 +1893,19 @@ Deno.test(
await server;
},
);
+
+Deno.test("Request with subarray TypedArray body", async () => {
+ const body = new Uint8Array([1, 2, 3, 4, 5]).subarray(1);
+ const req = new Request("https://example.com", { method: "POST", body });
+ const actual = new Uint8Array(await req.arrayBuffer());
+ const expected = new Uint8Array([2, 3, 4, 5]);
+ assertEquals(actual, expected);
+});
+
+Deno.test("Response with subarray TypedArray body", async () => {
+ const body = new Uint8Array([1, 2, 3, 4, 5]).subarray(1);
+ const req = new Response(body);
+ const actual = new Uint8Array(await req.arrayBuffer());
+ const expected = new Uint8Array([2, 3, 4, 5]);
+ assertEquals(actual, expected);
+});