webgear-server-1.1.0: Composable, type-safe library to build HTTP API servers
Safe HaskellSafe-Inferred
LanguageHaskell2010

WebGear.Server.MIMETypes

Synopsis

Parsing and rendering MIME types

class MIMEType mt => BodyUnrender m mt a where Source #

Methods

bodyUnrender :: mt -> Request -> m (Either Text a) Source #

Parse a request body. Return a Left value with error messages in case of failure.

Instances

Instances details
(MonadIO m, FromForm a) => BodyUnrender m FormURLEncoded a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

(MonadIO m, FromByteString a) => BodyUnrender m HTML a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

Methods

bodyUnrender :: HTML -> Request -> m (Either Text a) Source #

(MonadIO m, FromJSON a) => BodyUnrender m JSON a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

Methods

bodyUnrender :: JSON -> Request -> m (Either Text a) Source #

(MonadIO m, FromByteString a) => BodyUnrender m OctetStream a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

(MonadIO m, FromText a) => BodyUnrender m PlainText a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

MonadIO m => BodyUnrender m (FormData a) (FormDataResult a) Source # 
Instance details

Defined in WebGear.Server.MIMETypes

class MIMEType mt => BodyRender m mt a where Source #

Methods

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

Instances details
(Monad m, ToForm a) => BodyRender m FormURLEncoded a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

(Monad m, ToByteString a) => BodyRender m HTML a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

(Monad m, ToJSON a) => BodyRender m JSON a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

(Monad m, ToByteString a) => BodyRender m OctetStream a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

(Monad m, ToText a) => BodyRender m PlainText a Source # 
Instance details

Defined in WebGear.Server.MIMETypes

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.