From adc4866954e06e8fb98f42f59ad4ec1c9c8425d8 Mon Sep 17 00:00:00 2001 From: Vamshi Maskuri <117595548+varshith257@users.noreply.github.com> Date: Tue, 24 Sep 2024 08:16:52 +0530 Subject: [PATCH] content_length_1XX_204 --- zio-http/jvm/src/test/scala/zio/http/ServerSpec.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zio-http/jvm/src/test/scala/zio/http/ServerSpec.scala b/zio-http/jvm/src/test/scala/zio/http/ServerSpec.scala index ec4c9a37fb..c202defc3e 100644 --- a/zio-http/jvm/src/test/scala/zio/http/ServerSpec.scala +++ b/zio-http/jvm/src/test/scala/zio/http/ServerSpec.scala @@ -578,7 +578,7 @@ object ServerSpec extends RoutesRunnableSpec { } } + test("should not include Content-Length header for 1xx responses") { - val statusCodes = List(Status.Continue, Status.SwitchingProtocols, Status.Processing) // Add more if needed + val statusCodes = List(Status.Continue, Status.SwitchingProtocols, Status.Processing) ZIO .foreach(statusCodes) { status => @@ -588,9 +588,9 @@ object ServerSpec extends RoutesRunnableSpec { val request = Request.get("/info") for { response <- app.runZIO(request) - } yield assertTrue(!response.headers.contains(Header.ContentLength.name)) + } yield assertTrue(!response.headers.contains(Header.ContentLength.name)) // Ensure no Content-Length header } - .map(assertTrue(_)) + .map(assertTrue(_.forall(identity))) // Collect all results and assert they are true } + test("should not include Content-Length header for 204 No Content responses") { val route = Method.GET / "no-content" -> Handler.fromResponse(Response(status = Status.NoContent))