Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue225 #259

Merged
merged 18 commits into from May 2, 2019

Added default handlerWrapper

  • Loading branch information...
Tomas Herman
Tomas Herman committed Apr 27, 2019
commit a5b8e2897a0316fe5516351ecb12ec665f185191
@@ -77,7 +77,7 @@ object Http4sServerGenerator {
case GetExtraRouteParams(tracing) =>
for {
_ <- Target.log.debug("Http4sServerGenerator", "server")(s"getExtraRouteParams(${tracing})")
handlerWrapper = param"""handlerWrapper: (String, Request[F], F[Response[F]]) => F[Response[F]]"""
handlerWrapper = param"""handlerWrapper: (String, Request[F], F[Response[F]]) => F[Response[F]] = (_, _, r) => r"""
tracing <- if (tracing) {
Target.pure(List(param"""trace: String => Request[F] => TraceBuilder[F]"""))
} else Target.pure(List.empty)
@@ -31,7 +31,7 @@ class Issue225 extends FunSuite with Matchers with SwaggerSpecRunner {
}
"""
val resource = q"""
class Resource[F[_]](handlerWrapper: (String, Request[F], F[Response[F]]) => F[Response[F]])(implicit F: Async[F]) extends Http4sDsl[F] {
class Resource[F[_]](handlerWrapper: (String, Request[F], F[Response[F]]) => F[Response[F]] = (_, _, r) => r)(implicit F: Async[F]) extends Http4sDsl[F] {
def routes(handler: Handler[F]): HttpRoutes[F] = HttpRoutes.of {
{
case req @ GET -> Root => handlerWrapper("getRoot", req, {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.