summaryrefslogtreecommitdiff
path: root/cli/tests/unit/fetch_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r--cli/tests/unit/fetch_test.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts
index cf7510ea2..46eceb50c 100644
--- a/cli/tests/unit/fetch_test.ts
+++ b/cli/tests/unit/fetch_test.ts
@@ -3,6 +3,7 @@ import {
assert,
assertEquals,
assertThrowsAsync,
+ deferred,
fail,
unimplemented,
unitTest,
@@ -1195,3 +1196,24 @@ unitTest(
assertEquals(response.headers.get("Host"), addr);
},
);
+
+unitTest(
+ { perms: { net: true } },
+ async function fetchNoServerReadableStreamBody() {
+ const done = deferred();
+ const body = new ReadableStream({
+ start(controller) {
+ controller.enqueue(new Uint8Array([1]));
+ setTimeout(() => {
+ controller.enqueue(new Uint8Array([2]));
+ done.resolve();
+ }, 1000);
+ },
+ });
+ const nonExistantHostname = "http://localhost:47582";
+ await assertThrowsAsync(async () => {
+ await fetch(nonExistantHostname, { body, method: "POST" });
+ }, TypeError);
+ await done;
+ },
+);