Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 committed Sep 27, 2024
1 parent fd71331 commit fbd7ab8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ object StaticServerSpec extends RoutesRunnableSpec {
}
},
test("404 response ") {
checkAll(methodGenWithoutHEAD) { method =>
{ method =>
val actual = status(method, Path.root / "A")
assertZIO(actual)(equalTo(Status.NotFound))
}
Expand Down
7 changes: 2 additions & 5 deletions zio-http/shared/src/main/scala/zio/http/Routes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,10 @@ final case class Routes[-Env, +Err](routes: Chunk[zio.http.Route[Env, Err]]) { s
val allowedMethods = tree.getAllMethods(req.path)
chunk.length match {
case 0 =>
if (allowedMethods.isEmpty) {
// Case 1: Path doesn't exist at all -> 404 Not Found
Handler.notFound
if (!allowedMethods.contains(req.method) && allowedMethods.nonEmpty) {
Handler.status(Status.MethodNotAllowed)
} else if (!Method.knownMethods.contains(req.method)) {
Handler.status(Status.NotImplemented)
} else if (!allowedMethods.contains(req.method) && allowedMethods.nonEmpty) {
Handler.status(Status.MethodNotAllowed)
} else { Handler.notFound }
case 1 => chunk(0)
case n => // TODO: Support precomputed fallback among all chunk elements
Expand Down

0 comments on commit fbd7ab8

Please sign in to comment.