diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-10-19 17:01:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 17:01:36 +0200 |
commit | 08441b855d8cfbe7edd41811c8c719e5fae01f83 (patch) | |
tree | 0d8aa9e0984d284c2f6fbc83526eea13f7f61622 /cli/tests/unit | |
parent | 35028db5e571b4232dd58293cea7e5a8ec2e3571 (diff) |
fix(op_crates/fetch): Body.body should be stream of Uint8Array (#8030)
Diffstat (limited to 'cli/tests/unit')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 64309c269..ab9299711 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -133,6 +133,7 @@ unitTest({ perms: { net: true } }, async function fetchAsyncIterator(): Promise< assert(response.body !== null); let total = 0; for await (const chunk of response.body) { + assert(chunk instanceof Uint8Array); total += chunk.length; } @@ -145,12 +146,13 @@ unitTest({ perms: { net: true } }, async function fetchBodyReader(): Promise< const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const headers = response.headers; assert(response.body !== null); - const reader = await response.body.getReader(); + const reader = response.body.getReader(); let total = 0; while (true) { const { done, value } = await reader.read(); if (done) break; assert(value); + assert(value instanceof Uint8Array); total += value.length; } |