Copyright | (c) Raghu Kaippully 2020 |
---|---|
License | MPL-2.0 |
Maintainer | rkaippully@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Middlewares related to HTTP body.
Synopsis
- jsonRequestBody :: forall t m req res a. (FromJSON t, MonadRouter m, MonadIO m) => RequestMiddleware m req (JSONRequestBody t ': req) res a
- jsonResponseBody :: (ToJSON t, Monad m) => Middleware m req req res '[] t ByteString
Documentation
jsonRequestBody :: forall t m req res a. (FromJSON t, MonadRouter m, MonadIO m) => RequestMiddleware m req (JSONRequestBody t ': req) res a Source #
jsonResponseBody :: (ToJSON t, Monad m) => Middleware m req req res '[] t ByteString Source #
A middleware that converts the response that has a ToJSON
instance to a ByteString
response.
This will also set the "Content-Type" header of the response to "application/json".
Usage for a type t
which has a ToJSON
instance:
jsonResponseBody @t handler