1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -05:00
denoland-deno/tests/unit_node/fetch_test.ts
Luca Casonato b8cf259924
feat(fetch): accept async iterables for body (#26882)
Reland of #24623, but with a fix for `String` objects.

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-11-15 15:54:28 +01:00

18 lines
514 B
TypeScript

// 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"),
);
});