No implicit arguments of type: ZCompose

41 views Asked by At

I'm leaning zio2 http now and stuck with strange thing: intellij scala plugin can't add propper type to variable. The code from official zio documentation (https://zio.dev/zio-http/dsl/middleware/) listed below and works great, but it is hard for me work with a lot of errors in the simple service.

import zio.http._
import zio._

import java.io.IOException
import java.util.concurrent.TimeUnit

object Example extends ZIOAppDefault {
val app: App[Any] =
Http.collectZIO[Request] {
  // this will return result instantly
  case Method.GET -> Root / "text" => ZIO.succeed(Response.text("Hello World!"))
  // this will return result after 5 seconds, so with 3 seconds timeout it will fail
  case Method.GET -> Root / "long-running" => ZIO.succeed(Response.text("Hello World!")).delay(5.seconds)
}

val middlewares =
  RequestHandlerMiddlewares.debug ++ // print debug info about request and response 
    RequestHandlerMiddlewares.addHeader("X-Environment", "Dev") // add static header   

 override def run =
   Server.serve(app @@ middlewares).provide(Server.default)
}

Mb there are some tricky plugin or implicit to handle same situations? enter image description here

0

There are 0 answers