sttp.tapir.server.interceptor.RequestHandler.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tapir-server_native0.5_2.12 Show documentation
Show all versions of tapir-server_native0.5_2.12 Show documentation
Core classes for server interpreters & interceptors
The newest version!
package sttp.tapir.server.interceptor
import sttp.monad.MonadError
import sttp.tapir.model.ServerRequest
import sttp.tapir.server.ServerEndpoint
trait RequestHandler[F[_], R, B] {
def apply(request: ServerRequest, endpoints: List[ServerEndpoint[R, F]])(implicit monad: MonadError[F]): F[RequestResult[B]]
}
object RequestHandler {
def from[F[_], R, B](f: (ServerRequest, List[ServerEndpoint[R, F]], MonadError[F]) => F[RequestResult[B]]): RequestHandler[F, R, B] =
new RequestHandler[F, R, B] {
override def apply(request: ServerRequest, endpoints: List[ServerEndpoint[R, F]])(implicit
monad: MonadError[F]
): F[RequestResult[B]] = f(request, endpoints, monad)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy