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 cb2751a commit fd71331
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion zio-http/shared/src/main/scala/zio/http/Routes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +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 (!Method.knownMethods.contains(req.method)) {
if (allowedMethods.isEmpty) {
// Case 1: Path doesn't exist at all -> 404 Not Found
Handler.notFound
} else if (!Method.knownMethods.contains(req.method)) {
Handler.status(Status.NotImplemented)
} else if (!allowedMethods.contains(req.method) && allowedMethods.nonEmpty) {
Handler.status(Status.MethodNotAllowed)
Expand Down

0 comments on commit fd71331

Please sign in to comment.