HttpApp

zio.http.HttpApp
See theHttpApp companion object
final case class HttpApp[-Env](routes: Routes[Env, Response]) extends PartialFunction[Request, ZIO[Env, Response, Response]]

An HTTP application is a collection of routes, all of whose errors have been handled through conversion into HTTP responses.

HTTP applications can be installed into a zio.http.Server, which is capable of using them to serve requests.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait PartialFunction[Request, ZIO[Env, Response, Response]]
trait Request => ZIO[Env, Response, Response]
class Object
trait Matchable
class Any
Show all
Self type
HttpApp[Env]

Members list

Value members

Concrete methods

def ++[Env1 <: Env](that: HttpApp[Env1]): HttpApp[Env1]

Combines this HTTP application with the specified HTTP application. In case of route conflicts, the routes in this HTTP application take precedence over the routes in the specified HTTP application.

Combines this HTTP application with the specified HTTP application. In case of route conflicts, the routes in this HTTP application take precedence over the routes in the specified HTTP application.

Attributes

def @@[Env1 <: Env](aspect: Middleware[Env1]): HttpApp[Env1]

Applies the specified route aspect to every route in the HTTP application.

Applies the specified route aspect to every route in the HTTP application.

Attributes

def apply(request: Request): ZIO[Env, Response, Response]

Executes the HTTP application with the specified request input, returning an effect that will either succeed or fail with a Response.

Executes the HTTP application with the specified request input, returning an effect that will either succeed or fail with a Response.

Attributes

def isDefinedAt(request: Request): Boolean

Checks to see if the HTTP application may be defined at the specified request input. Note that it is still possible for an HTTP application to return a 404 Not Found response, which cannot be detected by this method. This method only checks for the presence of a handler that handles the method and path of the specified request.

Checks to see if the HTTP application may be defined at the specified request input. Note that it is still possible for an HTTP application to return a 404 Not Found response, which cannot be detected by this method. This method only checks for the presence of a handler that handles the method and path of the specified request.

Attributes

def provideEnvironment(env: ZEnvironment[Env]): HttpApp[Any]

Provides the specified environment to the HTTP application, returning a new HTTP application that has no environmental requirements.

Provides the specified environment to the HTTP application, returning a new HTTP application that has no environmental requirements.

Attributes

def run(method: Method, path: Path, headers: Headers, body: Body): ZIO[Env, Nothing, Response]
def runZIO(request: Request): ZIO[Env, Nothing, Response]

An alias for apply.

An alias for apply.

Attributes

def timeout(duration: Duration)(implicit trace: Trace): HttpApp[Env]

Returns a new HTTP application whose requests will be timed out after the specified duration elapses.

Returns a new HTTP application whose requests will be timed out after the specified duration elapses.

Attributes

def tree(implicit trace: Trace): Tree[Env]

Accesses the underlying tree that provides fast dispatch to handlers.

Accesses the underlying tree that provides fast dispatch to handlers.

Attributes

Inherited methods

def andThen[C](k: PartialFunction[ZIO[Env, Response, Response], C]): PartialFunction[A, C]

Attributes

Inherited from:
PartialFunction
override def andThen[C](k: ZIO[Env, Response, Response] => C): PartialFunction[A, C]

Attributes

Definition Classes
PartialFunction -> Function1
Inherited from:
PartialFunction
def applyOrElse[A1 <: Request, B1 >: ZIO[Env, Response, Response]](x: A1, default: A1 => B1): B1

Attributes

Inherited from:
PartialFunction
def compose[R](k: PartialFunction[R, Request]): PartialFunction[R, B]

Attributes

Inherited from:
PartialFunction
def compose[A](g: A => Request): A => R

Attributes

Inherited from:
Function1
def elementWise: ElementWiseExtractor[A, B]

Attributes

Inherited from:
PartialFunction
def lift: A => Option[B]

Attributes

Inherited from:
PartialFunction
def orElse[A1 <: Request, B1 >: ZIO[Env, Response, Response]](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]

Attributes

Inherited from:
PartialFunction
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def runWith[U](action: ZIO[Env, Response, Response] => U): A => Boolean

Attributes

Inherited from:
PartialFunction
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1
def unapply(a: Request): Option[B]

Attributes

Inherited from:
PartialFunction

Concrete fields

val toHandler: Handler[Env, Nothing, Request, Response]

Converts the HTTP application into a request handler.

Converts the HTTP application into a request handler.

Attributes