Skip to content

Commit

Permalink
Update RoutesSpec.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 authored Sep 11, 2024
1 parent d5e1e56 commit d0c1c40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zio-http/jvm/src/test/scala/zio/http/RoutesSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package zio.http

import zio._
import zio.test._

import zio.http.codec.PathCodec

object RoutesSpec extends ZIOHttpSpec {
Expand Down Expand Up @@ -123,10 +124,13 @@ object RoutesSpec extends ZIOHttpSpec {
long <- ZIO.service[Long]
} yield s"Int: $int, Long: $long"

val loggingAspect: HandlerAspect[Any, Nothing] = HandlerAspect.before { _ =>
ZIO.log("Request received")
}
val handler: Handler[Int & Long, Nothing, Request, Response] =
Handler.fromZIO(routeWithMultipleDeps.map(result => Response.text(result)))

val route: Route[Int & Long, Nothing] = RoutePattern(Method.GET, Path.root) -> handler
val route: Route[Int & Long, Nothing] = RoutePattern(Method.GET, Path.root) -> handler @@ loggingAspect

val routes = Routes(route)
val env = ZEnvironment(42).add(100L)
Expand Down

0 comments on commit d0c1c40

Please sign in to comment.