diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-07-08 04:25:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 22:25:34 -0400 |
commit | e4899b6ba417a801ce3d9128c9769e855487682f (patch) | |
tree | e610fc41996679ed9e863cddee028a0a22c36fa8 /cli/tests/unit/fetch_test.ts | |
parent | cb98a594522e44fca885ca94ffdcc181ad902603 (diff) |
perf(cli/body): improve .arrayBuffer() speed (#6669)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index f8ceebf6e..84f2c2822 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -851,6 +851,25 @@ unitTest( } ); +unitTest( + { perms: { net: true } }, + async function fetchResponseContentLength(): Promise<void> { + const body = new Uint8Array(2 ** 16); + const headers = new Headers([["content-type", "application/octet-stream"]]); + const res = await fetch("http://localhost:4545/echo_server", { + body: body, + method: "POST", + headers, + }); + assertEquals(Number(res.headers.get("content-length")), body.byteLength); + + const blob = await res.blob(); + // Make sure Body content-type is correctly set + assertEquals(blob.type, "application/octet-stream"); + assertEquals(blob.size, body.byteLength); + } +); + unitTest(function fetchResponseConstructorNullBody(): void { const nullBodyStatus = [204, 205, 304]; |