mig-0.2.1.0: Build lightweight and composable servers
Safe HaskellSafe-Inferred
LanguageGHC2021

Mig.Core.Class.MediaType

Description

Classes for MediaType and proper converters of Http values fromto parameters or requestresponse bodies.

Synopsis

Documentation

data MediaType #

An HTTP media type, consisting of the type, subtype, and parameters.

Instances

Instances details
IsString MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Show MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Eq MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Ord MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Accept MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

RenderHeader MediaType 
Instance details

Defined in Network.HTTP.Media.MediaType.Internal

HasContentType Encoding (Maybe MediaType) 
Instance details

Defined in Data.OpenApi.Lens

HasContent RequestBody (InsOrdHashMap MediaType MediaTypeObject) 
Instance details

Defined in Data.OpenApi.Lens

HasContent Response (InsOrdHashMap MediaType MediaTypeObject) 
Instance details

Defined in Data.OpenApi.Lens

class ToMediaType a where Source #

Conversion of type-level tags to media type values

class ToMediaType ty => ToRespBody ty b where Source #

Values that can be rendered to response body byte string.

Methods

toRespBody :: b -> ByteString Source #

data Json Source #

Type-level tag for JSON media type It is converted to "application/json"

Instances

Instances details
ToMediaType Json Source # 
Instance details

Defined in Mig.Core.Class.MediaType

FromJSON a => FromReqBody Json a Source # 
Instance details

Defined in Mig.Core.Class.MediaType

ToJSON a => ToRespBody Json a Source # 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString Source #

data FormUrlEncoded Source #

Type-level tag for FORM url encoded media-type. It is converted to "application/x-www-form-urlencoded"

Instances

Instances details
ToMediaType FormUrlEncoded Source # 
Instance details

Defined in Mig.Core.Class.MediaType

FromForm a => FromReqBody FormUrlEncoded a Source # 
Instance details

Defined in Mig.Core.Class.MediaType

ToForm a => ToRespBody FormUrlEncoded a Source # 
Instance details

Defined in Mig.Core.Class.MediaType

Methods

toRespBody :: a -> ByteString Source #

data OctetStream Source #

Media type octet stream is for passing raw byte-strings in the request body. It is converted to "application/octet-stream"

data AnyMedia Source #

Signifies any media. It prescribes the server renderer to lookup media-type at run-time in the "Conten-Type" header. As media-type it is rendered to "*/*".

It is useful for values for which we want to derive content type from run-time values. For example it is used for static file servers to get media type from file extension.

class ToMediaType ty => FromReqBody ty b where Source #

Values that can be parsed from request byte string.