wai-extra-3.1.17: Provides some basic WAI handlers and middleware.
CopyrightMichael Snoyman
LicenseBSD3
MaintainerMichael Snoyman <michael@snoyman.com>
StabilityUnstable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Wai.Middleware.Select

Description

Dynamically choose between Middlewares

It's useful when you want some Middlewares applied selectively.

Example: do not log health check calls:

import Network.Wai
import Network.Wai.Middleware.HealthCheckEndpoint
import Network.Wai.Middleware.RequestLogger

app' :: Application
app' =
  selectMiddleware (selectMiddlewareExceptRawPathInfo "/_healthz" logStdout)
    $ healthCheck app

Since: 3.1.10

Synopsis

Middleware selection

Helpers

selectMiddlewareOn :: (Request -> Bool) -> Middleware -> MiddlewareSelection Source #

Use the Middleware when the predicate holds.