Skip to content

Commit

Permalink
chore(conformance): cleanup netty exception tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Saturn225 authored Oct 1, 2024
1 parent 1948dc4 commit 6514ff7
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions zio-http/jvm/src/test/scala/zio/http/ConformanceE2ESpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,6 @@ object ConformanceE2ESpec extends RoutesRunnableSpec {
val res = routes.deploy.status.run(path = Path.root, headers = Headers(Header.Host("localhost")))
assertZIO(res)(equalTo(Status.Ok))
},
test("should return 400 Bad Request if header contains CR, LF, or NULL (reject_fields_containing_cr_lf_nul)") {
val routes = Handler.ok.toRoutes

val resCRLF =
routes.deploy.status.run(path = Path.root / "test", headers = Headers("InvalidHeader" -> "Value\r\n"))
val resNull =
routes.deploy.status.run(path = Path.root / "test", headers = Headers("InvalidHeader" -> "Value\u0000"))

for {
responseCRLF <- resCRLF
responseNull <- resNull
} yield assertTrue(
responseCRLF == Status.BadRequest,
responseNull == Status.BadRequest,
)
},
test("should return 400 Bad Request if there is whitespace between start-line and first header field") {
val route = Method.GET / "test" -> Handler.ok
val routes = Routes(route)

val malformedRequest = Request
.get("/test")
.copy(headers = Headers.empty)
.withBody(Body.fromString("\r\nHost: localhost"))

val res = routes.deploy.status.run(path = Path.root / "test", headers = malformedRequest.headers)
assertZIO(res)(equalTo(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 routes = Routes(route)

val requestWithWhitespaceHeader = Request.get("/test").addHeader(Header.Custom("Invalid Header ", "value"))

val res = routes.deploy.status.run(path = Path.root / "test", headers = requestWithWhitespaceHeader.headers)
assertZIO(res)(equalTo(Status.BadRequest))
},
)

override def spec =
Expand Down

0 comments on commit 6514ff7

Please sign in to comment.