From c53044854447d6401f9d035efdb7f40cbe503b7a Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 14 Feb 2023 20:23:57 +0000 Subject: [PATCH] Add streaming request test to Node.js suite --- .../test/scala/org/http4s/dom/NodeJSFetchSuite.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testsNodeJS/src/test/scala/org/http4s/dom/NodeJSFetchSuite.scala b/testsNodeJS/src/test/scala/org/http4s/dom/NodeJSFetchSuite.scala index cb19ebfa..e095df62 100644 --- a/testsNodeJS/src/test/scala/org/http4s/dom/NodeJSFetchSuite.scala +++ b/testsNodeJS/src/test/scala/org/http4s/dom/NodeJSFetchSuite.scala @@ -19,6 +19,8 @@ package dom import cats.effect.IO import cats.effect.Resource +import fs2.Stream +import org.http4s.Method._ import org.http4s.client.Client import org.http4s.client.testkit.ClientRouteTestBattery @@ -27,6 +29,16 @@ import scala.concurrent.duration._ class NodeJSFetchSuite extends ClientRouteTestBattery("FetchClient") { def clientResource: Resource[IO, Client[IO]] = FetchClientBuilder[IO].resource + test("POST a chunked body with streaming requests") { + val address = server().addresses.head + val baseUrl = Uri.fromString(s"http://$address/").toOption.get + FetchClientBuilder[IO] + .withStreamingRequests + .create + .expect[String](POST(Stream("This is chunked.").covary[IO], baseUrl / "echo")) + .assertEquals("This is chunked.") + } + test("Cancel an in-flight request") { val address = server().addresses.head client()