Route

zio.http.Route
See theRoute companion object
sealed trait Route[-Env, +Err]

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Route[Env, Err]

Members list

Value members

Abstract methods

The location where the route was created, which is useful for debugging purposes.

The location where the route was created, which is useful for debugging purposes.

Attributes

The route pattern over which the route is defined. The route can only handle requests that match this route pattern.

The route pattern over which the route is defined. The route can only handle requests that match this route pattern.

Attributes

def toHandler(implicit ev: Err <:< Response, trace: Trace): Handler[Env, Response, Request, Response]

Concrete methods

final def apply(request: Request)(implicit ev: Err <:< Response, trace: Trace): ZIO[Env, Response, Response]

Applies the route to the specified request. The route must be defined for the request, or else this method will fail fatally. Note that you may only call this function when you have handled all errors produced by the route, converting them into responses.

Applies the route to the specified request. The route must be defined for the request, or else this method will fail fatally. Note that you may only call this function when you have handled all errors produced by the route, converting them into responses.

Attributes

def asErrorType[Err2](implicit ev: Err <:< Err2): Route[Env, Err2]
final def handleError(f: Err => Response)(implicit trace: Trace): Route[Env, Nothing]

Handles the error of the route. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles the error of the route. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Attributes

final def handleErrorCause(f: Cause[Err] => Response)(implicit trace: Trace): Route[Env, Nothing]

Handles the error of the route. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Handles the error of the route. This method can be used to convert a route that does not handle its errors into one that does handle its errors.

Attributes

final def isDefinedAt(request: Request): Boolean

Determines if the route is defined for the specified request.

Determines if the route is defined for the specified request.

Attributes

final def provideEnvironment(env: ZEnvironment[Env]): Route[Any, Err]
final def sandbox(implicit trace: Trace): Route[Env, Nothing]

Returns a route that automatically translates all failures into responses, using best-effort heuristics to determine the appropriate HTTP status code, and attaching error details using the HTTP header Warning.

Returns a route that automatically translates all failures into responses, using best-effort heuristics to determine the appropriate HTTP status code, and attaching error details using the HTTP header Warning.

Attributes

final def toHttpApp(implicit ev: Err <:< Response): HttpApp[Env]
def transform[Env1](f: Handler[Env, Response, Request, Response] => Handler[Env1, Response, Request, Response]): Route[Env1, Err]