Skip to content

Commit

Permalink
Add streaming request test to Node.js suite
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Feb 14, 2023
1 parent e66aa7d commit c530448
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions testsNodeJS/src/test/scala/org/http4s/dom/NodeJSFetchSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Expand Down

0 comments on commit c530448

Please sign in to comment.