mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
fix(ext/fetch): subview Uint8Array in Req/Resp (#18890)
This commit is contained in:
parent
de5bd4e536
commit
84b921555f
2 changed files with 28 additions and 30 deletions
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue