From 825ef5def06a6b40828c5d0022c615bfb77d0573 Mon Sep 17 00:00:00 2001 From: Nabil Abdel-Hafeez <7283535+987Nabil@users.noreply.github.com> Date: Thu, 5 Sep 2024 12:21:32 +0200 Subject: [PATCH] Add `Endpoint#implementAsZIO` (#3085) --- .../shared/src/main/scala/zio/http/endpoint/Endpoint.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zio-http/shared/src/main/scala/zio/http/endpoint/Endpoint.scala b/zio-http/shared/src/main/scala/zio/http/endpoint/Endpoint.scala index 0d6e737922..317230d08e 100644 --- a/zio-http/shared/src/main/scala/zio/http/endpoint/Endpoint.scala +++ b/zio-http/shared/src/main/scala/zio/http/endpoint/Endpoint.scala @@ -245,6 +245,11 @@ final case class Endpoint[PathInput, Input, Err, Output, Auth <: AuthType]( ): Route[Any, Nothing] = implementHandler[Any](Handler.succeed(output)) + def implementAsZIO(output: ZIO[Any, Err, Output])(implicit + trace: Trace, + ): Route[Any, Nothing] = + implementHandler[Any](Handler.fromZIO(output)) + def implementAsError(err: Err)(implicit trace: Trace, ): Route[Any, Nothing] =