From 356746bebbf6ad9ba38e8f8610077039f420eb80 Mon Sep 17 00:00:00 2001 From: Vamshi Maskuri <117595548+varshith257@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:41:13 +0530 Subject: [PATCH] add conformance suite --- .../test/scala/zio/http/ConformanceSpec.scala | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/zio-http/jvm/src/test/scala/zio/http/ConformanceSpec.scala b/zio-http/jvm/src/test/scala/zio/http/ConformanceSpec.scala index 0999249c65..97762685e8 100644 --- a/zio-http/jvm/src/test/scala/zio/http/ConformanceSpec.scala +++ b/zio-http/jvm/src/test/scala/zio/http/ConformanceSpec.scala @@ -278,21 +278,21 @@ object ConformanceSpec extends ZIOHttpSpec { for { response <- app.runZIO(malformedRequest) } yield assertTrue(response.status == Status.BadRequest) - } - test "should return 400 Bad Request if there is whitespace between header field and colon" { - val route = Method.GET / "test" -> Handler.ok - val app = Routes(route) - - // Crafting a request with a whitespace between the header field name and the colon - // val requestWithWhitespaceHeader = Request.get("/test").addHeader("Invalid Header : value") - val requestWithWhitespaceHeader = Request.get("/test").addHeader(Header.Custom("Invalid Header ", "value")) - - for { - response <- app.runZIO(requestWithWhitespaceHeader) - } yield { - assertTrue(response.status == Status.BadRequest) // Expecting a 400 Bad Request - } - }, + }, + test("should return 400 Bad Request if there is whitespace between header field and colon") { + val route = Method.GET / "test" -> Handler.ok + val app = Routes(route) + + // Crafting a request with a whitespace between the header field name and the colon + // val requestWithWhitespaceHeader = Request.get("/test").addHeader("Invalid Header : value") + val requestWithWhitespaceHeader = Request.get("/test").addHeader(Header.Custom("Invalid Header ", "value")) + + for { + response <- app.runZIO(requestWithWhitespaceHeader) + } yield { + assertTrue(response.status == Status.BadRequest) // Expecting a 400 Bad Request + } + }, test("should not include Content-Length header for 1xx and 204 No Content responses") { // Defining routes for different status codes val route1xxContinue = Method.GET / "continue" -> Handler.fromResponse(Response(status = Status.Continue))