o

zio.http

RequestHandlerMiddlewares

object RequestHandlerMiddlewares extends RequestHandlerMiddlewares

Linear Supertypes
RequestHandlerMiddlewares, HtmlErrorResponses, HeaderModifier[RequestHandlerMiddleware[Nothing, Any, Nothing, Any]], Auth, Metrics, RequestLogging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RequestHandlerMiddlewares
  2. RequestHandlerMiddlewares
  3. HtmlErrorResponses
  4. HeaderModifier
  5. Auth
  6. Metrics
  7. RequestLogging
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final class InterceptPatch[S] extends AnyVal
  2. final class InterceptPatchZIO[R, E, S] extends AnyVal

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def addCookie(cookie: Cookie.Response): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Sets cookie in response headers

    Sets cookie in response headers

    Definition Classes
    RequestHandlerMiddlewares
  5. final def addCookieZIO[R](cookie: ZIO[R, Nothing, Cookie.Response])(implicit trace: Trace): RequestHandlerMiddleware[Nothing, R, Nothing, Any]
    Definition Classes
    RequestHandlerMiddlewares
  6. final def addHeader(name: CharSequence, value: CharSequence): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  7. final def addHeader(header: Header): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  8. final def addHeaders(headers: Headers): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. final def basicAuth(u: String, p: String): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    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

    Definition Classes
    Auth
  11. final def basicAuth(f: (Credentials) => Boolean): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Creates a middleware for basic authentication

    Creates a middleware for basic authentication

    Definition Classes
    Auth
  12. final def basicAuthZIO[R, E](f: (Credentials) => ZIO[R, E, Boolean])(implicit trace: Trace): RequestHandlerMiddleware[Nothing, R, E, Any]

    Creates a middleware for basic authentication using an effectful verification function

    Creates a middleware for basic authentication using an effectful verification function

    Definition Classes
    Auth
  13. final def bearerAuth(f: (String) => Boolean): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    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

    Definition Classes
    Auth
  14. final def bearerAuthZIO[R, E](f: (String) => ZIO[R, E, Boolean])(implicit trace: Trace): RequestHandlerMiddleware[Nothing, R, E, Any]

    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

    Definition Classes
    Auth
  15. final def beautifyErrors: RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Beautify the error response.

    Beautify the error response.

    Definition Classes
    RequestHandlerMiddlewares
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  17. final def customAuth(verify: (Request) => Boolean, responseHeaders: Headers = Headers.empty, responseStatus: Status = Status.Unauthorized): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    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.

    Definition Classes
    Auth
  18. final def customAuthProviding[R0, Context](provide: (Request) => Option[Context], responseHeaders: Headers = Headers.empty, responseStatus: Status = Status.Unauthorized)(implicit arg0: Tag[Context]): WithOut[R0 with Context, Any, Nothing, Any, [Env]R0, [Err]Err]

    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.

    Definition Classes
    Auth
  19. final def customAuthProvidingZIO[R0, R, E, Context](provide: (Request) => ZIO[R, E, Option[Context]], responseHeaders: Headers = Headers.empty, responseStatus: Status = Status.Unauthorized)(implicit arg0: Tag[Context]): WithOut[R0 with R with Context, R, E, Any, [Env]R0 with R, [Err]Err]

    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.

    Definition Classes
    Auth
  20. final def customAuthZIO[R, E](verify: (Request) => ZIO[R, E, Boolean], responseHeaders: Headers = Headers.empty, responseStatus: Status = Status.Unauthorized): RequestHandlerMiddleware[Nothing, R, E, Any]

    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.

    Definition Classes
    Auth
  21. final def debug: RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Add log status, method, url and time taken from req to res

    Add log status, method, url and time taken from req to res

    Definition Classes
    RequestHandlerMiddlewares
  22. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. final def ifHeaderThenElse[UpperEnv, LowerErr](condition: (Headers) => Boolean)(ifTrue: RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any], ifFalse: RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]): RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]

    Logical operator to decide which middleware to select based on the header

    Logical operator to decide which middleware to select based on the header

    Definition Classes
    RequestHandlerMiddlewares
  27. final def ifMethodThenElse[UpperEnv, LowerErr](condition: (Method) => Boolean)(ifTrue: RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any], ifFalse: RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]): RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]

    Logical operator to decide which middleware to select based on the method.

    Logical operator to decide which middleware to select based on the method.

    Definition Classes
    RequestHandlerMiddlewares
  28. final def ifRequestThenElse[UpperEnv, LowerErr](condition: (Request) => Boolean)(ifTrue: RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any], ifFalse: RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]): RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]

    Logical operator to decide which middleware to select based on the predicate.

    Logical operator to decide which middleware to select based on the predicate.

    Definition Classes
    RequestHandlerMiddlewares
  29. final def ifRequestThenElseFunction[UpperEnv, LowerErr](condition: (Request) => Boolean)(ifTrue: (Request) => RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any], ifFalse: (Request) => RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]): RequestHandlerMiddleware[Nothing, UpperEnv, LowerErr, Any]
    Definition Classes
    RequestHandlerMiddlewares
  30. final def ifRequestThenElseFunctionZIO[R, E](condition: (Request) => ZIO[R, E, Boolean])(ifTrue: (Request) => Simple[R, E], ifFalse: (Request) => Simple[R, E]): RequestHandlerMiddleware[Nothing, R, E, Any]
    Definition Classes
    RequestHandlerMiddlewares
  31. final def ifRequestThenElseZIO[R, E](condition: (Request) => ZIO[R, E, Boolean])(ifTrue: RequestHandlerMiddleware[Nothing, R, E, Any], ifFalse: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

    Logical operator to decide which middleware to select based on the predicate.

    Logical operator to decide which middleware to select based on the predicate.

    Definition Classes
    RequestHandlerMiddlewares
  32. final def intercept(fromRequestAndResponse: (Request, Response) => Response): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    RequestHandlerMiddlewares
  33. final def interceptPatch[S](fromRequest: (Request) => S): InterceptPatch[S]

    Creates a new middleware using transformation functions

    Creates a new middleware using transformation functions

    Definition Classes
    RequestHandlerMiddlewares
  34. final def interceptPatchZIO[R, E, S](fromRequest: (Request) => ZIO[R, E, S]): InterceptPatchZIO[R, E, S]

    Creates a new middleware using effectful transformation functions

    Creates a new middleware using effectful transformation functions

    Definition Classes
    RequestHandlerMiddlewares
  35. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  36. def metrics(pathLabelMapper: PartialFunction[Request, String] = Map.empty, concurrentRequestsName: String = "http_concurrent_requests_total", totalRequestsName: String = "http_requests_total", requestDurationName: String = "http_request_duration_seconds", requestDurationBoundaries: Boundaries = Metrics.defaultBoundaries, extraLabels: Set[MetricLabel] = Set.empty): HttpAppMiddleware[Nothing, Any, Nothing, Any]

    Adds metrics to a zio-http server.

    Adds metrics to a zio-http server.

    pathLabelMapper

    A mapping function to map incoming paths to patterns, such as /users/1 to /users/:id.

    totalRequestsName

    Total HTTP requests metric name.

    requestDurationName

    HTTP request duration metric name.

    requestDurationBoundaries

    Boundaries for the HTTP request duration metric.

    extraLabels

    A set of extra labels all metrics will be tagged with.

    Definition Classes
    Metrics
    Note

    When using Prometheus as your metrics backend, make sure to provide a pathLabelMapper in order to avoid high cardinality labels.

  37. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  38. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  39. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  40. final def patch(f: (Response) => Patch): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Creates a middleware that produces a Patch for the Response

    Creates a middleware that produces a Patch for the Response

    Definition Classes
    RequestHandlerMiddlewares
  41. final def patchZIO[R, E](f: (Response) => ZIO[R, E, Patch]): RequestHandlerMiddleware[Nothing, R, E, Any]

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

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

    Definition Classes
    RequestHandlerMiddlewares
  42. final def redirect(url: URL, isPermanent: Boolean): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Client redirect temporary or permanent to specified url.

    Client redirect temporary or permanent to specified url.

    Definition Classes
    RequestHandlerMiddlewares
  43. final def redirectTrailingSlash(isPermanent: Boolean)(implicit trace: Trace): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Permanent redirect if the trailing slash is present in the request URL.

    Permanent redirect if the trailing slash is present in the request URL.

    Definition Classes
    RequestHandlerMiddlewares
  44. final def removeHeader(name: String): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  45. final def removeHeader(headerType: HeaderType): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  46. final def removeHeaders(headers: Set[String]): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  47. final def replace[R, E](newHandler: RequestHandler[R, E]): RequestHandlerMiddleware[Nothing, R, E, Any]
    Definition Classes
    RequestHandlerMiddlewares
  48. def replaceErrorResponse(request: Request, response: Response): Response
    Attributes
    protected
    Definition Classes
    HtmlErrorResponses
  49. final def requestLogging(level: (Status) => LogLevel = (_: Status) => LogLevel.Info, failureLevel: LogLevel = LogLevel.Warning, loggedRequestHeaders: Set[HeaderType] = Set.empty, loggedResponseHeaders: Set[HeaderType] = Set.empty, logRequestBody: Boolean = false, logResponseBody: Boolean = false, requestCharset: Charset = StandardCharsets.UTF_8, responseCharset: Charset = StandardCharsets.UTF_8)(implicit trace: Trace): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    RequestLogging
  50. final def runAfter[R](effect: ZIO[R, Nothing, Any])(implicit trace: Trace): RequestHandlerMiddleware[Nothing, R, Nothing, Any]

    Runs the effect after the middleware is applied

    Runs the effect after the middleware is applied

    Definition Classes
    RequestHandlerMiddlewares
  51. final def runBefore[R, E](effect: ZIO[R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

    Runs the effect before the request is passed on to the HttpApp on which the middleware is applied.

    Runs the effect before the request is passed on to the HttpApp on which the middleware is applied.

    Definition Classes
    RequestHandlerMiddlewares
  52. final def setHeaders(headers: Headers): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  53. final def signCookies(secret: String): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Creates a middleware for signing cookies

    Creates a middleware for signing cookies

    Definition Classes
    RequestHandlerMiddlewares
  54. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  55. final def timeout(duration: zio.Duration): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Times out the application with a 408 status code.

    Times out the application with a 408 status code.

    Definition Classes
    RequestHandlerMiddlewares
  56. def toString(): String
    Definition Classes
    AnyRef → Any
  57. final def updateHeaders(update: (Headers) => Headers): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Updates the provided list of headers to the response

    Updates the provided list of headers to the response

    Definition Classes
    RequestHandlerMiddlewares → HeaderModifier
  58. final def updateResponse(f: (Response) => Response): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Creates a middleware that updates the response produced

    Creates a middleware that updates the response produced

    Definition Classes
    RequestHandlerMiddlewares
  59. final def updateResponseZIO[R](f: (Response) => ZIO[R, Nothing, Response]): RequestHandlerMiddleware[Nothing, R, Nothing, Any]
    Definition Classes
    RequestHandlerMiddlewares
  60. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  61. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  62. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  63. final def whenHeader[R, E](condition: (Headers) => Boolean)(middleware: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

    Applies the middleware only when the condition for the headers are true

    Applies the middleware only when the condition for the headers are true

    Definition Classes
    RequestHandlerMiddlewares
  64. final def whenRequest[R, E](condition: (Request) => Boolean)(middleware: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

    Applies the middleware only if the condition function evaluates to true

    Applies the middleware only if the condition function evaluates to true

    Definition Classes
    RequestHandlerMiddlewares
  65. final def whenRequestZIO[R, E](condition: (Request) => ZIO[R, E, Boolean])(middleware: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]
    Definition Classes
    RequestHandlerMiddlewares
  66. final def whenResponse[R, E](condition: (Response) => Boolean)(middleware: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

    Applies the middleware only if the condition function evaluates to true

    Applies the middleware only if the condition function evaluates to true

    Definition Classes
    RequestHandlerMiddlewares
  67. final def whenResponseZIO[R, E](condition: (Response) => ZIO[R, E, Boolean])(middleware: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

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

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

    Definition Classes
    RequestHandlerMiddlewares
  68. final def whenStatus[R, E](condition: (Status) => Boolean)(middleware: RequestHandlerMiddleware[Nothing, R, E, Any]): RequestHandlerMiddleware[Nothing, R, E, Any]

    Applies the middleware only if status matches the condition

    Applies the middleware only if status matches the condition

    Definition Classes
    RequestHandlerMiddlewares
  69. def withHeader(header: Header): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]
    Definition Classes
    HeaderModifier
  70. final def withStatus(status: Status): RequestHandlerMiddleware[Nothing, Any, Nothing, Any]

    Creates a new middleware that always sets the response status to the provided value

    Creates a new middleware that always sets the response status to the provided value

    Definition Classes
    RequestHandlerMiddlewares

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from RequestHandlerMiddlewares

Inherited from HtmlErrorResponses

Inherited from Auth

Inherited from Metrics

Inherited from RequestLogging

Inherited from AnyRef

Inherited from Any

Ungrouped