Skip to content

Commit

Permalink
Update ConformanceSpec.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
Saturn225 authored Jan 23, 2025
1 parent 3773a78 commit 36237c8
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions zio-http/jvm/src/test/scala/zio/http/ConformanceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,6 @@ object ConformanceSpec extends ZIOSpecDefault {
response.status == Status.Unauthorized,
)
},
test("should include Allow header for 405 Method Not Allowed response(code_405_allow)") {
val app = Routes(
Method.POST / "not-allowed" -> Handler.fromResponse(
Response
.status(Status.Ok),
),
)

val request = Request.get("/not-allowed")

for {
response <- app.runZIO(request)
} yield assertTrue(
response.status == Status.MethodNotAllowed,
response.headers.contains(Header.Allow.name),
)
},
test(
"should include Proxy-Authenticate header for 407 Proxy Authentication Required response(code_407_proxy_authenticate)",
) {
Expand Down Expand Up @@ -820,35 +803,6 @@ object ConformanceSpec extends ZIOSpecDefault {
response.status == Status.NotFound,
)
},
test("should reply with 501 for unknown HTTP methods (code_501_unknown_methods)") {
val app = Routes(
Method.GET / "test" -> Handler.fromResponse(Response.status(Status.Ok)),
)

val unknownMethodRequest = Request(method = Method.CUSTOM("ABC"), url = URL(Path.root / "test"))

for {
response <- app.runZIO(unknownMethodRequest)
} yield assertTrue(
response.status == Status.NotImplemented,
)
},
test(
"should reply with 405 when the request method is not allowed for the target resource (code_405_blocked_methods)",
) {
val app = Routes(
Method.GET / "test" -> Handler.fromResponse(Response.status(Status.Ok)),
)

// Testing a disallowed method (e.g., CONNECT)
val connectMethodRequest = Request(method = Method.CONNECT, url = URL(Path.root / "test"))

for {
response <- app.runZIO(connectMethodRequest)
} yield assertTrue(
response.status == Status.MethodNotAllowed,
)
},
),
suite("HTTP/1.1")(
test("should not generate a bare CR in headers for HTTP/1.1(no_bare_cr)") {
Expand Down Expand Up @@ -1083,24 +1037,6 @@ object ConformanceSpec extends ZIOSpecDefault {
secondResponse.headers.contains(Header.Connection.name),
)
},
test("should not return forbidden duplicate headers in response(duplicate_fields)") {
val app = Routes(
Method.GET / "test" -> Handler.fromResponse(
Response
.status(Status.Ok)
.addHeader(Header.XFrameOptions.Deny)
.addHeader(Header.XFrameOptions.SameOrigin),
),
)
for {
response <- app.runZIO(Request.get("/test"))
} yield {
val xFrameOptionsHeaders = response.headers.toList.collect {
case h if h.headerName == Header.XFrameOptions.name => h
}
assertTrue(xFrameOptionsHeaders.length == 1)
}
},
suite("Content-Length")(
test("Content-Length in HEAD must match the one in GET (content_length_same_head_get)") {
val getResponse = Response
Expand Down

0 comments on commit 36237c8

Please sign in to comment.