module Network.Wai.Middleware.HealthCheckEndpoint
( healthCheck,
voidEndpoint,
)
where
import Data.ByteString (ByteString)
import Network.HTTP.Types (status200)
import Network.Wai
healthCheck :: Middleware
healthCheck :: Middleware
healthCheck = ByteString -> Middleware
voidEndpoint ByteString
"/_healthz"
voidEndpoint :: ByteString -> Middleware
voidEndpoint :: ByteString -> Middleware
voidEndpoint ByteString
endpointPath Application
router Request
request Response -> IO ResponseReceived
respond =
if Request -> ByteString
rawPathInfo Request
request forall a. Eq a => a -> a -> Bool
== ByteString
endpointPath
then Response -> IO ResponseReceived
respond forall a b. (a -> b) -> a -> b
$ Status -> ResponseHeaders -> ByteString -> Response
responseLBS Status
status200 forall a. Monoid a => a
mempty ByteString
"-"
else Application
router Request
request Response -> IO ResponseReceived
respond