Skip to content

Commit

Permalink
Whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 committed Sep 23, 2024
1 parent cba1cf2 commit a6f3571
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions zio-http/jvm/src/test/scala/zio/http/ServerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,19 @@ object ServerSpec extends RoutesRunnableSpec {
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")

for {
response <- app.runZIO(requestWithWhitespaceHeader)
} yield {
assertTrue(response.status == Status.BadRequest) // Expecting a 400 Bad Request
}
}
}

Expand Down

0 comments on commit a6f3571

Please sign in to comment.