Http

sealed trait Http[-R, +E, -A, +B] extends A => ZIO[R, Option[E], B]

A functional domain to model Http apps using ZIO and that can work over any kind of request and response types.

Companion:
object
trait A => ZIO[R, Option[E], B]
class Object
trait Matchable
class Any
Http[R, E, A, B]

Value members

Concrete methods

final def *>[R1 <: R, E1 >: E, A1 <: A, C1](other: Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]

Alias for zipRight

Alias for zipRight

final def ++[R1 <: R, E1 >: E, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Combines two Http into one.

Combines two Http into one.

final def <<<[R1 <: R, E1 >: E, A1 <: A, X](other: Http[R1, E1, X, A1]): Http[R1, E1, X, B]

Composes one Http app with another.

Composes one Http app with another.

final def <>[R1 <: R, E1, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Runs self but if it fails, runs other, ignoring the result from self.

Runs self but if it fails, runs other, ignoring the result from self.

final def >>=[R1 <: R, E1 >: E, A1 <: A, C1](f: B => Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]

Alias for flatmap

Alias for flatmap

final def >>>[R1 <: R, E1 >: E, B1 >: B, C](other: Http[R1, E1, B1, C]): Http[R1, E1, A, C]

Pipes the output of one app into the other

Pipes the output of one app into the other

final def @@[R1 <: R, E1 >: E, A1 <: A, B1 >: B, A2, B2](mid: Middleware[R1, E1, A1, B1, A2, B2]): Http[R1, E1, A2, B2]

Attaches the provided middleware to the Http app

Attaches the provided middleware to the Http app

final def andThen[R1 <: R, E1 >: E, B1 >: B, C](other: Http[R1, E1, B1, C]): Http[R1, E1, A, C]

Named alias for >>>

Named alias for >>>

final def apply(a: A): ZIO[R, Option[E], B]

Consumes the input and executes the Http.

Consumes the input and executes the Http.

final def as[C](c: C): Http[R, E, A, C]

Makes the app resolve with a constant value

Makes the app resolve with a constant value

final def body(implicit eb: IsResponse[B], ee: E <:< Throwable): Http[R, Throwable, A, Chunk[Byte]]

Extracts body

Extracts body

final def bodyAsString(implicit eb: IsResponse[B], ee: E <:< Throwable): Http[R, Throwable, A, String]

Extracts body as a string

Extracts body as a string

final def catchAll[R1 <: R, E1, A1 <: A, B1 >: B](f: E => Http[R1, E1, A1, B1])(implicit ev: CanFail[E]): Http[R1, E1, A1, B1]

Catches all the exceptions that the http app can fail with

Catches all the exceptions that the http app can fail with

final def collect[R1 <: R, E1 >: E, A1 <: A, B1 >: B, C](pf: PartialFunction[B1, C]): Http[R1, E1, A1, C]

Collects some of the results of the http and converts it to another type.

Collects some of the results of the http and converts it to another type.

final def collectManaged[R1 <: R, E1 >: E, A1 <: A, B1 >: B, C](pf: PartialFunction[B1, ZManaged[R1, E1, C]]): Http[R1, E1, A1, C]
final def collectZIO[R1 <: R, E1 >: E, A1 <: A, B1 >: B, C](pf: PartialFunction[B1, ZIO[R1, E1, C]]): Http[R1, E1, A1, C]

Collects some of the results of the http and effectfully converts it to another type.

Collects some of the results of the http and effectfully converts it to another type.

final def compose[R1 <: R, E1 >: E, A1 <: A, C1](other: Http[R1, E1, C1, A1]): Http[R1, E1, C1, B]

Named alias for <<<

Named alias for <<<

final def contentLength(implicit eb: IsResponse[B]): Http[R, E, A, Option[Long]]

Extracts content-length from the response if available

Extracts content-length from the response if available

final def contraFlatMap[X]: PartialContraFlatMap[R, E, A, B, X]

Transforms the input of the http before passing it on to the current Http

Transforms the input of the http before passing it on to the current Http

final def contramap[X](xa: X => A): Http[R, E, X, B]

Transforms the input of the http before passing it on to the current Http

Transforms the input of the http before passing it on to the current Http

final def contramapZIO[R1 <: R, E1 >: E, X](xa: X => ZIO[R1, E1, A]): Http[R1, E1, X, B]

Transforms the input of the http before giving it effectfully

Transforms the input of the http before giving it effectfully

final def defaultWith[R1 <: R, E1 >: E, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Named alias for ++

Named alias for ++

final def delay(duration: Duration): Http[R & Clock, E, A, B]

Delays production of output B for the specified duration of time

Delays production of output B for the specified duration of time

final def delayAfter(duration: Duration): Http[R & Clock, E, A, B]

Delays production of output B for the specified duration of time

Delays production of output B for the specified duration of time

final def delayBefore(duration: Duration): Http[R & Clock, E, A, B]

Delays consumption of input A for the specified duration of time

Delays consumption of input A for the specified duration of time

final def flatMap[R1 <: R, E1 >: E, A1 <: A, C1](f: B => Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]

Creates a new Http app from another

Creates a new Http app from another

final def flatten[R1 <: R, E1 >: E, A1 <: A, B1](implicit ev: B <:< Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Flattens an Http app of an Http app

Flattens an Http app of an Http app

final def foldHttp[R1 <: R, A1 <: A, E1, B1](ee: E => Http[R1, E1, A1, B1], bb: B => Http[R1, E1, A1, B1], dd: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Folds over the http app by taking in two functions one for success and one for failure respectively.

Folds over the http app by taking in two functions one for success and one for failure respectively.

final def headerValue(name: CharSequence)(implicit eb: IsResponse[B]): Http[R, E, A, Option[CharSequence]]

Extracts the value of the provided header name.

Extracts the value of the provided header name.

final def headers(implicit eb: IsResponse[B]): Http[R, E, A, Headers]

Extracts the Headers from the type B if possible

Extracts the Headers from the type B if possible

final def map[C](bc: B => C): Http[R, E, A, C]

Transforms the output of the http app

Transforms the output of the http app

final def mapError[E1](ee: E => E1): Http[R, E1, A, B]

Transforms the failure of the http app

Transforms the failure of the http app

final def mapZIO[R1 <: R, E1 >: E, C](bFc: B => ZIO[R1, E1, C]): Http[R1, E1, A, C]

Transforms the output of the http effectfully

Transforms the output of the http effectfully

final def middleware[R1 <: R, E1 >: E, A1 <: A, B1 >: B, A2, B2](mid: Middleware[R1, E1, A1, B1, A2, B2]): Http[R1, E1, A2, B2]

Named alias for @@

Named alias for @@

final def orElse[R1 <: R, E1, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Named alias for <>

Named alias for <>

final def provide(r: R)(implicit ev: NeedsEnv[R]): Http[Any, E, A, B]

Provides the environment to Http.

Provides the environment to Http.

final def provideCustomLayer[E1 >: E, R1 <: Has[_]](layer: ZLayer[ZEnv, E1, R1])(implicit ev: ZEnv & R1 <:< R, tagged: Tag[R1]): Http[ZEnv, E1, A, B]

Provide part of the environment to HTTP that is not part of ZEnv

Provide part of the environment to HTTP that is not part of ZEnv

final def provideLayer[E1 >: E, R0, R1](layer: ZLayer[R0, E1, R1])(implicit ev1: R1 <:< R, ev2: NeedsEnv[R]): Http[R0, E1, A, B]

Provides layer to Http.

Provides layer to Http.

final def provideSome[R1 <: R](r: R1 => R)(implicit ev: NeedsEnv[R]): Http[R1, E, A, B]

Provides some of the environment to Http.

Provides some of the environment to Http.

final def provideSomeLayer[R0 <: Has[_], R1 <: Has[_], E1 >: E](layer: ZLayer[R0, E1, R1])(implicit ev: R0 & R1 <:< R, tagged: Tag[R1]): Http[R0, E1, A, B]

Provides some of the environment to Http leaving the remainder R0.

Provides some of the environment to Http leaving the remainder R0.

final def race[R1 <: R, E1 >: E, A1 <: A, B1 >: B](other: Http[R1, E1, A1, B1]): Http[R1, E1, A1, B1]

Performs a race between two apps

Performs a race between two apps

final def status(implicit ev: IsResponse[B]): Http[R, E, A, Status]

Extracts Status from the type B is possible.

Extracts Status from the type B is possible.

final def tap[R1 <: R, E1 >: E, A1 <: A](f: B => Http[R1, E1, Any, Any]): Http[R1, E1, A, B]

Returns an Http that peeks at the success of this Http.

Returns an Http that peeks at the success of this Http.

final def tapAll[R1 <: R, E1 >: E](f: E => Http[R1, E1, Any, Any], g: B => Http[R1, E1, Any, Any], h: Http[R1, E1, Any, Any]): Http[R1, E1, A, B]

Returns an Http that peeks at the success, failed or empty value of this Http.

Returns an Http that peeks at the success, failed or empty value of this Http.

final def tapAllZIO[R1 <: R, E1 >: E](f: E => ZIO[R1, E1, Any], g: B => ZIO[R1, E1, Any], h: ZIO[R1, E1, Any]): Http[R1, E1, A, B]

Returns an Http that effectfully peeks at the success, failed or empty value of this Http.

Returns an Http that effectfully peeks at the success, failed or empty value of this Http.

final def tapError[R1 <: R, E1 >: E](f: E => Http[R1, E1, Any, Any]): Http[R1, E1, A, B]

Returns an Http that peeks at the failure of this Http.

Returns an Http that peeks at the failure of this Http.

final def tapErrorZIO[R1 <: R, E1 >: E](f: E => ZIO[R1, E1, Any]): Http[R1, E1, A, B]

Returns an Http that effectfully peeks at the failure of this Http.

Returns an Http that effectfully peeks at the failure of this Http.

final def tapZIO[R1 <: R, E1 >: E](f: B => ZIO[R1, E1, Any]): Http[R1, E1, A, B]

Returns an Http that effectfully peeks at the success of this Http.

Returns an Http that effectfully peeks at the success of this Http.

final def unwrap[R1 <: R, E1 >: E, C](implicit ev: B <:< ZIO[R1, E1, C]): Http[R1, E1, A, C]

Unwraps an Http that returns a ZIO of Http

Unwraps an Http that returns a ZIO of Http

final def widen[E1, B1](implicit e: E <:< E1, b: B <:< B1): Http[R, E1, A, B1]

Widens the type of the output

Widens the type of the output

final def zipRight[R1 <: R, E1 >: E, A1 <: A, C1](other: Http[R1, E1, A1, C1]): Http[R1, E1, A1, C1]

Combines the two apps and returns the result of the one on the right

Combines the two apps and returns the result of the one on the right

Inherited methods

def andThen[A](g: ZIO[R, Option[E], B] => A): A => A
Inherited from:
Function1
def compose[A](g: A => A): A => ZIO[R, Option[E], B]
Inherited from:
Function1
override def toString(): String
Definition Classes
Function1 -> Any
Inherited from:
Function1