Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class MIMEType mt => BodyUnrender m mt a where
- bodyUnrender :: mt -> Request -> m (Either Text a)
- class MIMEType mt => BodyRender m mt a where
- bodyRender :: mt -> Response -> a -> m (MediaType, ResponseBody)
- inMemoryBackend :: BackEnd ByteString
- tempFileBackend :: MonadResource m => m (BackEnd FilePath)
Parsing and rendering MIME types
class MIMEType mt => BodyUnrender m mt a where Source #
bodyUnrender :: mt -> Request -> m (Either Text a) Source #
Parse a request body. Return a Left
value with error messages
in case of failure.
Instances
(MonadIO m, FromForm a) => BodyUnrender m FormURLEncoded a Source # | |
Defined in WebGear.Server.MIMETypes bodyUnrender :: FormURLEncoded -> Request -> m (Either Text a) Source # | |
(MonadIO m, FromByteString a) => BodyUnrender m HTML a Source # | |
Defined in WebGear.Server.MIMETypes | |
(MonadIO m, FromJSON a) => BodyUnrender m JSON a Source # | |
Defined in WebGear.Server.MIMETypes | |
(MonadIO m, FromByteString a) => BodyUnrender m OctetStream a Source # | |
Defined in WebGear.Server.MIMETypes bodyUnrender :: OctetStream -> Request -> m (Either Text a) Source # | |
(MonadIO m, FromText a) => BodyUnrender m PlainText a Source # | |
Defined in WebGear.Server.MIMETypes | |
MonadIO m => BodyUnrender m (FormData a) (FormDataResult a) Source # | |
Defined in WebGear.Server.MIMETypes bodyUnrender :: FormData a -> Request -> m (Either Text (FormDataResult a)) Source # |
class MIMEType mt => BodyRender m mt a where Source #
bodyRender :: mt -> Response -> a -> m (MediaType, ResponseBody) Source #
Render a value in the format specified by the media type.
Returns the response body and the media type to be used in the "Content-Type" header. This could be a variant of the original media type with additional parameters.
Instances
(Monad m, ToForm a) => BodyRender m FormURLEncoded a Source # | |
Defined in WebGear.Server.MIMETypes bodyRender :: FormURLEncoded -> Response -> a -> m (MediaType, ResponseBody) Source # | |
(Monad m, ToByteString a) => BodyRender m HTML a Source # | |
Defined in WebGear.Server.MIMETypes bodyRender :: HTML -> Response -> a -> m (MediaType, ResponseBody) Source # | |
(Monad m, ToJSON a) => BodyRender m JSON a Source # | |
Defined in WebGear.Server.MIMETypes bodyRender :: JSON -> Response -> a -> m (MediaType, ResponseBody) Source # | |
(Monad m, ToByteString a) => BodyRender m OctetStream a Source # | |
Defined in WebGear.Server.MIMETypes bodyRender :: OctetStream -> Response -> a -> m (MediaType, ResponseBody) Source # | |
(Monad m, ToText a) => BodyRender m PlainText a Source # | |
Defined in WebGear.Server.MIMETypes bodyRender :: PlainText -> Response -> a -> m (MediaType, ResponseBody) Source # |
FormData utils
inMemoryBackend :: BackEnd ByteString Source #
A backend that stores all files in memory
tempFileBackend :: MonadResource m => m (BackEnd FilePath) Source #
A backend that stores files in a temp directory.