Skip to content

Commit

Permalink
Update RoutePattern.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
Saturn225 authored Sep 30, 2024
1 parent 63a43aa commit 4f3ce6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion zio-http/shared/src/main/scala/zio/http/RoutePattern.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ final case class RoutePattern[A](method: Method, pathCodec: PathCodec[A]) { self
* Returns a new pattern that is extended with the specified segment pattern.
*/
def /[B](that: PathCodec[B])(implicit combiner: Combiner[A, B]): RoutePattern[combiner.Out] =
copy(pathCodec = pathCodec ++ that)
if (that == PathCodec.empty) self.asInstanceOf[RoutePattern[combiner.Out]]
else if (pathCodec == PathCodec.empty) copy(pathCodec = that.asInstanceOf[PathCodec[combiner.Out]])
else copy(pathCodec = pathCodec ++ that)

/**
* Creates a route from this pattern and the specified handler.
Expand Down

0 comments on commit 4f3ce6f

Please sign in to comment.