summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/fetch_test.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts
index 204a159a7..83386d2ee 100644
--- a/cli/tests/unit/fetch_test.ts
+++ b/cli/tests/unit/fetch_test.ts
@@ -1951,6 +1951,33 @@ Deno.test(
},
);
+Deno.test(
+ { permissions: { net: true } },
+ async function fetchRequestBodyEmptyStream() {
+ const body = new ReadableStream({
+ start(controller) {
+ controller.enqueue(new Uint8Array([]));
+ controller.close();
+ },
+ });
+
+ await assertRejects(
+ async () => {
+ const controller = new AbortController();
+ const promise = fetch("http://localhost:4545/echo_server", {
+ body,
+ method: "POST",
+ signal: controller.signal,
+ });
+ controller.abort();
+ await promise;
+ },
+ DOMException,
+ "The signal has been aborted",
+ );
+ },
+);
+
Deno.test("Request with subarray TypedArray body", async () => {
const body = new Uint8Array([1, 2, 3, 4, 5]).subarray(1);
const req = new Request("https://example.com", { method: "POST", body });