diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2024-08-06 00:13:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 00:13:02 -0700 |
commit | ba40347a35d10cffeae83ee95f69f7bc281096dd (patch) | |
tree | 0e981a32601937293967815292d5bf617914163a /tests/unit_node/fetch_test.ts | |
parent | f0cd2c45fcd4dfb841cee9d36bdda3be25c1a2a5 (diff) |
feat(fetch): accept async iterables for body (#24623)
Implements https://github.com/whatwg/webidl/pull/1397
Fixes #21454
Closes #24849
Diffstat (limited to 'tests/unit_node/fetch_test.ts')
-rw-r--r-- | tests/unit_node/fetch_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit_node/fetch_test.ts b/tests/unit_node/fetch_test.ts new file mode 100644 index 000000000..399d6052a --- /dev/null +++ b/tests/unit_node/fetch_test.ts @@ -0,0 +1,18 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +import { assertEquals } from "@std/assert"; +import { createReadStream } from "node:fs"; + +Deno.test("fetch node stream", async () => { + const file = createReadStream("tests/testdata/assets/fixture.json"); + + const response = await fetch("http://localhost:4545/echo_server", { + method: "POST", + body: file, + }); + + assertEquals( + await response.text(), + await Deno.readTextFile("tests/testdata/assets/fixture.json"), + ); +}); |