HandlerAspect

zio.http.HandlerAspect
See theHandlerAspect companion class
object HandlerAspect

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
trait HeaderModifier[HandlerAspect[Any, Unit]]
class Object
trait Matchable
class Any
Show all
Self type

Members list

Type members

Classlikes

final class Allow(val unit: Unit) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class AllowZIO(val unit: Unit) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class InterceptPatch[State](val fromRequest: Request => State) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class InterceptPatchZIO[Env, State](val fromRequest: Request => ZIO[Env, Response, State]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Inherited types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Inherited methods

def addCookie(cookie: Response): HandlerAspect[Any, Unit]

Sets a cookie in the response headers

Sets a cookie in the response headers

Attributes

Inherited from:
HandlerAspects (hidden)
def addCookieZIO[Env](cookie: ZIO[Env, Nothing, Response])(implicit trace: Trace): HandlerAspect[Env, Unit]

Sets an effectfully created cookie in the response headers.

Sets an effectfully created cookie in the response headers.

Attributes

Inherited from:
HandlerAspects (hidden)
final def addHeader(name: CharSequence, value: CharSequence): A

Attributes

Inherited from:
HeaderModifier
final def addHeader(header: Header): A

Attributes

Inherited from:
HeaderModifier
final def addHeaders(headers: Headers): A

Attributes

Inherited from:
HeaderModifier
def allow: Allow

Creates a middleware which can allow or disallow access to an http based on the predicate

Creates a middleware which can allow or disallow access to an http based on the predicate

Attributes

Inherited from:
HandlerAspects (hidden)

Creates a middleware which can allow or disallow access to an http based on the effectful predicate.

Creates a middleware which can allow or disallow access to an http based on the effectful predicate.

Attributes

Inherited from:
HandlerAspects (hidden)
def basicAuth(u: String, p: String): HandlerAspect[Any, Unit]

Creates a middleware for basic authentication that checks if the credentials are same as the ones given

Creates a middleware for basic authentication that checks if the credentials are same as the ones given

Attributes

Inherited from:
HandlerAspects (hidden)
def basicAuth(f: Credentials => Boolean): HandlerAspect[Any, Unit]

Creates a middleware for basic authentication

Creates a middleware for basic authentication

Attributes

Inherited from:
HandlerAspects (hidden)
def basicAuthZIO[Env](f: Credentials => ZIO[Env, Response, Boolean])(implicit trace: Trace): HandlerAspect[Env, Unit]

Creates a middleware for basic authentication using an effectful verification function

Creates a middleware for basic authentication using an effectful verification function

Attributes

Inherited from:
HandlerAspects (hidden)
def bearerAuth(f: String => Boolean): HandlerAspect[Any, Unit]

Creates a middleware for bearer authentication that checks the token using the given function

Creates a middleware for bearer authentication that checks the token using the given function

Value parameters

f:

function that validates the token string inside the Bearer Header

Attributes

Inherited from:
HandlerAspects (hidden)
def bearerAuthZIO[Env](f: String => ZIO[Env, Response, Boolean])(implicit trace: Trace): HandlerAspect[Env, Unit]

Creates a middleware for bearer authentication that checks the token using the given effectful function

Creates a middleware for bearer authentication that checks the token using the given effectful function

Value parameters

f:

function that effectfully validates the token string inside the Bearer Header

Attributes

Inherited from:
HandlerAspects (hidden)
def beautifyErrors: HandlerAspect[Any, Unit]

Beautify the error response.

Beautify the error response.

Attributes

Inherited from:
HandlerAspects (hidden)
def customAuth(verify: Request => Boolean, responseHeaders: Headers, responseStatus: Status): HandlerAspect[Any, Unit]

Creates an authentication middleware that only allows authenticated requests to be passed on to the app.

Creates an authentication middleware that only allows authenticated requests to be passed on to the app.

Attributes

Inherited from:
HandlerAspects (hidden)
final def customAuthProviding[Context](provide: Request => Option[Context], responseHeaders: Headers, responseStatus: Status): HandlerAspect[Any, Context]

Creates an authentication middleware that only allows authenticated requests to be passed on to the app, and provides a context to the request handlers.

Creates an authentication middleware that only allows authenticated requests to be passed on to the app, and provides a context to the request handlers.

Attributes

Inherited from:
HandlerAspects (hidden)
def customAuthProvidingZIO[Env, Context](provide: Request => ZIO[Env, Response, Option[Context]], responseHeaders: Headers, responseStatus: Status): HandlerAspect[Env, Context]

Creates an authentication middleware that only allows authenticated requests to be passed on to the app, and provides a context to the request handlers.

Creates an authentication middleware that only allows authenticated requests to be passed on to the app, and provides a context to the request handlers.

Attributes

Inherited from:
HandlerAspects (hidden)
def customAuthZIO[Env](verify: Request => ZIO[Env, Response, Boolean], responseHeaders: Headers, responseStatus: Status): HandlerAspect[Env, Unit]

Creates an authentication middleware that only allows authenticated requests to be passed on to the app using an effectful verification function.

Creates an authentication middleware that only allows authenticated requests to be passed on to the app using an effectful verification function.

Attributes

Inherited from:
HandlerAspects (hidden)
def debug: HandlerAspect[Any, Unit]

Creates middleware that debugs request and response.

Creates middleware that debugs request and response.

Attributes

Inherited from:
HandlerAspects (hidden)
def dropTrailingSlash(onlyIfNoQueryParams: Boolean): HandlerAspect[Any, Unit]

Creates middleware that drops trailing slashes from the request URL.

Creates middleware that drops trailing slashes from the request URL.

Attributes

Inherited from:
HandlerAspects (hidden)

Creates middleware that drops trailing slashes from the request URL.

Creates middleware that drops trailing slashes from the request URL.

Attributes

Inherited from:
HandlerAspects (hidden)
def fail(response: Response): HandlerAspect[Any, Unit]

Creates middleware that aborts the request with the specified response. No downstream middleware will be invoked.

Creates middleware that aborts the request with the specified response. No downstream middleware will be invoked.

Attributes

Inherited from:
HandlerAspects (hidden)
def failWith(f: Request => Response): HandlerAspect[Any, Unit]

Creates middleware that aborts the request with the specified response. No downstream middleware will be invoked.

Creates middleware that aborts the request with the specified response. No downstream middleware will be invoked.

Attributes

Inherited from:
HandlerAspects (hidden)
def ifHeaderThenElse[Env, Ctx](condition: Headers => Boolean)(ifTrue: HandlerAspect[Env, Ctx], ifFalse: HandlerAspect[Env, Ctx]): HandlerAspect[Env, Ctx]

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, applied to the incoming request's headers.

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, applied to the incoming request's headers.

Attributes

Inherited from:
HandlerAspects (hidden)
def ifMethodThenElse[Env, Ctx](condition: Method => Boolean)(ifTrue: HandlerAspect[Env, Ctx], ifFalse: HandlerAspect[Env, Ctx]): HandlerAspect[Env, Ctx]

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, applied to the incoming request's method.

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, applied to the incoming request's method.

Attributes

Inherited from:
HandlerAspects (hidden)
def ifRequestThenElse[Env, CtxOut](predicate: Request => Boolean)(ifTrue: HandlerAspect[Env, CtxOut], ifFalse: HandlerAspect[Env, CtxOut]): HandlerAspect[Env, CtxOut]

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, applied to the incoming request.

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, applied to the incoming request.

Attributes

Inherited from:
HandlerAspects (hidden)
def ifRequestThenElseZIO[Env, CtxOut](predicate: Request => ZIO[Env, Response, Boolean])(ifTrue: HandlerAspect[Env, CtxOut], ifFalse: HandlerAspect[Env, CtxOut]): HandlerAspect[Env, CtxOut]

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, effectfully applied to the incoming request.

Creates conditional middleware that switches between one middleware and another based on the result of the predicate, effectfully applied to the incoming request.

Attributes

Inherited from:
HandlerAspects (hidden)
def intercept(fromRequestAndResponse: (Request, Response) => Response): HandlerAspect[Any, Unit]

Creates middleware that modifies the response, potentially using the request.

Creates middleware that modifies the response, potentially using the request.

Attributes

Inherited from:
HandlerAspects (hidden)
def interceptHandler[Env, CtxOut](incoming0: Handler[Env, Response, Request, (Request, CtxOut)])(outgoing0: Handler[Env, Nothing, Response, Response]): HandlerAspect[Env, CtxOut]

Creates middleware that will apply the specified stateless handlers to incoming and outgoing requests. If the incoming handler fails, then the outgoing handler will not be invoked.

Creates middleware that will apply the specified stateless handlers to incoming and outgoing requests. If the incoming handler fails, then the outgoing handler will not be invoked.

Attributes

Inherited from:
HandlerAspects (hidden)
def interceptHandlerStateful[Env, State0, CtxOut](incoming0: Handler[Env, Response, Request, (State0, (Request, CtxOut))])(outgoing0: Handler[Env, Nothing, (State0, Response), Response]): HandlerAspect[Env, CtxOut]

Creates middleware that will apply the specified stateful handlers to incoming and outgoing requests. If the incoming handler fails, then the outgoing handler will not be invoked.

Creates middleware that will apply the specified stateful handlers to incoming and outgoing requests. If the incoming handler fails, then the outgoing handler will not be invoked.

Attributes

Inherited from:
HandlerAspects (hidden)
def interceptIncomingHandler[Env, CtxOut](handler: Handler[Env, Response, Request, (Request, CtxOut)]): HandlerAspect[Env, CtxOut]

Creates middleware that will apply the specified handler to incoming requests.

Creates middleware that will apply the specified handler to incoming requests.

Attributes

Inherited from:
HandlerAspects (hidden)
def interceptOutgoingHandler[Env](handler: Handler[Env, Nothing, Response, Response]): HandlerAspect[Env, Unit]

Creates middleware that will apply the specified handler to outgoing responses.

Creates middleware that will apply the specified handler to outgoing responses.

Attributes

Inherited from:
HandlerAspects (hidden)
def interceptPatch[S](fromRequest: Request => S): InterceptPatch[S]

Creates a new middleware using transformation functions

Creates a new middleware using transformation functions

Attributes

Inherited from:
HandlerAspects (hidden)
def interceptPatchZIO[Env, S](fromRequest: Request => ZIO[Env, Response, S]): InterceptPatchZIO[Env, S]

Creates a new middleware using effectful transformation functions

Creates a new middleware using effectful transformation functions

Attributes

Inherited from:
HandlerAspects (hidden)
def patch(f: Response => Patch): HandlerAspect[Any, Unit]

Creates a middleware that produces a Patch for the Response

Creates a middleware that produces a Patch for the Response

Attributes

Inherited from:
HandlerAspects (hidden)
def patchZIO[Env](f: Response => ZIO[Env, Response, Patch]): HandlerAspect[Env, Unit]

Creates a middleware that produces a Patch for the Response effectfully.

Creates a middleware that produces a Patch for the Response effectfully.

Attributes

Inherited from:
HandlerAspects (hidden)
def redirect(url: URL, isPermanent: Boolean): HandlerAspect[Any, Unit]

Creates a middleware that will redirect requests to the specified URL.

Creates a middleware that will redirect requests to the specified URL.

Attributes

Inherited from:
HandlerAspects (hidden)
def redirectTrailingSlash(isPermanent: Boolean): HandlerAspect[Any, Unit]

Creates middleware that will redirect requests with trailing slash to the same path without trailing slash.

Creates middleware that will redirect requests with trailing slash to the same path without trailing slash.

Attributes

Inherited from:
HandlerAspects (hidden)
final def removeHeader(name: String): A

Attributes

Inherited from:
HeaderModifier
final def removeHeader(headerType: HeaderType): A

Attributes

Inherited from:
HeaderModifier
final def removeHeaders(headers: Set[String]): A

Attributes

Inherited from:
HeaderModifier
def requestLogging(level: Status => LogLevel, loggedRequestHeaders: Set[HeaderType], loggedResponseHeaders: Set[HeaderType], logRequestBody: Boolean, logResponseBody: Boolean, requestCharset: Charset, responseCharset: Charset)(implicit trace: Trace): HandlerAspect[Any, Unit]

Creates middleware that will perform request logging.

Creates middleware that will perform request logging.

Attributes

Inherited from:
HandlerAspects (hidden)
def runAfter[Env](effect: ZIO[Env, Nothing, Any])(implicit trace: Trace): HandlerAspect[Env, Unit]

Creates middleware that will run the specified effect after every request.

Creates middleware that will run the specified effect after every request.

Attributes

Inherited from:
HandlerAspects (hidden)
def runBefore[Env](effect: ZIO[Env, Nothing, Any])(implicit trace: Trace): HandlerAspect[Env, Unit]

Creates middleware that will run the specified effect before every request.

Creates middleware that will run the specified effect before every request.

Attributes

Inherited from:
HandlerAspects (hidden)
final def setHeaders(headers: Headers): A

Attributes

Inherited from:
HeaderModifier
def signCookies(secret: String): HandlerAspect[Any, Unit]

Creates a middleware for signing cookies

Creates a middleware for signing cookies

Attributes

Inherited from:
HandlerAspects (hidden)
def status(status: Status): HandlerAspect[Any, Unit]

Creates middleware that will update the status of the response.

Creates middleware that will update the status of the response.

Attributes

Inherited from:
HandlerAspects (hidden)
override def updateHeaders(update: Headers => Headers)(implicit trace: Trace): HandlerAspect[Any, Unit]

Creates middleware that will update the headers of the response.

Creates middleware that will update the headers of the response.

Attributes

Definition Classes
HandlerAspects -> HeaderModifier
Inherited from:
HandlerAspects (hidden)
def updateMethod(update: Method => Method): HandlerAspect[Any, Unit]

Creates middleware that will update the method of the request.

Creates middleware that will update the method of the request.

Attributes

Inherited from:
HandlerAspects (hidden)
def updatePath(update: Path => Path): HandlerAspect[Any, Unit]

Creates middleware that will update the path of the request.

Creates middleware that will update the path of the request.

Attributes

Inherited from:
HandlerAspects (hidden)
def updateRequest(update: Request => Request): HandlerAspect[Any, Unit]

Creates middleware that will update the request.

Creates middleware that will update the request.

Attributes

Inherited from:
HandlerAspects (hidden)
def updateRequestZIO[Env](update: Request => ZIO[Env, Response, Request]): HandlerAspect[Env, Unit]

Creates middleware that will update the request effectfully.

Creates middleware that will update the request effectfully.

Attributes

Inherited from:
HandlerAspects (hidden)
def updateResponse(update: Response => Response): HandlerAspect[Any, Unit]

Creates middleware that will update the response.

Creates middleware that will update the response.

Attributes

Inherited from:
HandlerAspects (hidden)
def updateResponseZIO[Env](update: Response => ZIO[Env, Nothing, Response]): HandlerAspect[Env, Unit]

Creates middleware that will update the response effectfully.

Creates middleware that will update the response effectfully.

Attributes

Inherited from:
HandlerAspects (hidden)
def updateURL(update: URL => URL): HandlerAspect[Any, Unit]

Creates middleware that will update the URL of the request.

Creates middleware that will update the URL of the request.

Attributes

Inherited from:
HandlerAspects (hidden)
def when[Env](condition: Request => Boolean)(middleware: HandlerAspect[Env, Unit]): HandlerAspect[Env, Unit]

Applies the middleware only if the condition function evaluates to true

Applies the middleware only if the condition function evaluates to true

Attributes

Inherited from:
HandlerAspects (hidden)
def whenHeader[Env](condition: Headers => Boolean)(middleware: HandlerAspect[Env, Unit]): HandlerAspect[Env, Unit]

Applies the middleware only when the header-based condition evaluates to true.

Applies the middleware only when the header-based condition evaluates to true.

Attributes

Inherited from:
HandlerAspects (hidden)
def whenResponse(condition: Response => Boolean)(f: Response => Response): HandlerAspect[Any, Unit]

Applies the middleware only if the condition function evaluates to true

Applies the middleware only if the condition function evaluates to true

Attributes

Inherited from:
HandlerAspects (hidden)
def whenResponseZIO[Env](condition: Response => ZIO[Env, Response, Boolean])(f: Response => ZIO[Env, Response, Response]): HandlerAspect[Env, Unit]

Applies the middleware only if the condition function effectfully evaluates to true

Applies the middleware only if the condition function effectfully evaluates to true

Attributes

Inherited from:
HandlerAspects (hidden)
def whenZIO[Env](condition: Request => ZIO[Env, Response, Boolean])(middleware: HandlerAspect[Env, Unit]): HandlerAspect[Env, Unit]

Applies the middleware only if the condition function effectfully evaluates to true

Applies the middleware only if the condition function effectfully evaluates to true

Attributes

Inherited from:
HandlerAspects (hidden)

Inherited fields

val identity: HandlerAspect[Any, Unit]

The identity middleware, which has no effect on request or response.

The identity middleware, which has no effect on request or response.

Attributes

Inherited from:
HandlerAspects (hidden)