diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2022-11-09 17:20:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 17:20:05 +0900 |
commit | 9edcab524fef558abce824731e78f83f7aac28dd (patch) | |
tree | bb78f8e648500d954dcde8d1a9f9bb153d63da98 /cli/tests/unit/flash_test.ts | |
parent | c08fcd96c1d2e903101718c4792d2b5faec94b24 (diff) |
fix(ext/flash): revert #16284 and add test case (#16576)
Diffstat (limited to 'cli/tests/unit/flash_test.ts')
-rw-r--r-- | cli/tests/unit/flash_test.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts index e2e64dfe3..024069455 100644 --- a/cli/tests/unit/flash_test.ts +++ b/cli/tests/unit/flash_test.ts @@ -2282,6 +2282,40 @@ Deno.test( }, ); +// Checks large streaming response +// https://github.com/denoland/deno/issues/16567 +Deno.test( + { permissions: { net: true } }, + async function testIssue16567() { + const ac = new AbortController(); + const promise = deferred(); + const server = Deno.serve(() => + new Response( + new ReadableStream({ + start(c) { + // 2MB "a...a" response with 40 chunks + for (const _ of Array(40)) { + c.enqueue(new Uint8Array(50_000).fill(97)); + } + c.close(); + }, + }), + ), { + async onListen() { + const res1 = await fetch("http://localhost:9000/"); + assertEquals((await res1.text()).length, 40 * 50_000); + + promise.resolve(); + ac.abort(); + }, + signal: ac.signal, + }); + + await promise; + await server; + }, +); + function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader { // Based on https://tools.ietf.org/html/rfc2616#section-19.4.6 const tp = new TextProtoReader(r); |