Safe Haskell | None |
---|---|
Language | Haskell2010 |
- jsonErrors :: Application -> Application
- responseModifier :: Response -> Response
- jsonErrorResponse :: Status -> ResponseHeaders -> ByteString -> Response
- responseBody :: Response -> Maybe ByteString
- isPlainTextError :: Status -> ResponseHeaders -> Bool
- errorInfo :: Response -> Maybe (Status, ResponseHeaders, ByteString)
- isContentType :: ByteString -> ResponseHeaders -> Bool
Documentation
jsonErrors :: Application -> Application Source #
Converts errors from plaintext to json.
Example: a plaintext json parsing error returns a 400 status code and a message: > Error in $: key "firstName" not present
Using this middleware it would look like this: > { > "status": 400, > "error": "Error in $: key "firstName" not present" > }
responseModifier :: Response -> Response Source #
jsonErrorResponse :: Status -> ResponseHeaders -> ByteString -> Response Source #
responseBody :: Response -> Maybe ByteString Source #
isPlainTextError :: Status -> ResponseHeaders -> Bool Source #
errorInfo :: Response -> Maybe (Status, ResponseHeaders, ByteString) Source #
isContentType :: ByteString -> ResponseHeaders -> Bool Source #