Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 committed Sep 25, 2024
1 parent 7c2863e commit c1205ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ object NotFoundSpec extends ZIOHttpSpec {
result = response.status == Status.NotFound
} yield assertTrue(result)
}

def test405[R](service: Routes[R, Nothing])(
url: String,
method: Method,
Expand Down
6 changes: 3 additions & 3 deletions zio-http/shared/src/main/scala/zio/http/Routes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ final case class Routes[-Env, +Err](routes: Chunk[zio.http.Route[Env, Err]]) { s
chunk.length match {
case 0 =>
val allowedMethods = Method.all.filter(method => tree.get(method, req.path).nonEmpty)
if (allowedMethods.nonEmpty) {
if (allowedMethods.isEmpty) {
Handler.notFound
} else {
Handler.succeed(
Response
.status(Status.MethodNotAllowed)
.addHeader(Header.Allow(NonEmptyChunk.fromIterable(allowedMethods.head, allowedMethods.tail))),
)
} else {
Handler.notFound
}
case 1 => chunk(0)
case n => // TODO: Support precomputed fallback among all chunk elements
Expand Down

0 comments on commit c1205ca

Please sign in to comment.