summaryrefslogtreecommitdiff
path: root/cli/tests/unit/flash_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/flash_test.ts')
-rw-r--r--cli/tests/unit/flash_test.ts34
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);