diff options
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r-- | js/fetch_test.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/js/fetch_test.ts b/js/fetch_test.ts index b93f7845a..032727dbc 100644 --- a/js/fetch_test.ts +++ b/js/fetch_test.ts @@ -33,6 +33,17 @@ testPerm({ net: true }, async function fetchBlob(): Promise<void> { assertEquals(blob.size, Number(headers.get("Content-Length"))); }); +testPerm({ net: true }, async function fetchAsyncIterator(): Promise<void> { + const response = await fetch("http://localhost:4545/package.json"); + const headers = response.headers; + let total = 0; + for await (const chunk of response.body) { + total += chunk.length; + } + + assertEquals(total, Number(headers.get("Content-Length"))); +}); + testPerm({ net: true }, async function responseClone(): Promise<void> { const response = await fetch("http://localhost:4545/package.json"); const response1 = response.clone(); |