| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.HTTP.Media.MediaType
Contents
Description
Defines the MediaType accept header with an Accept instance for use
in content-type negotiation.
- data MediaType
- type Parameters = Map ByteString ByteString
- (//) :: ByteString -> ByteString -> MediaType
- (/:) :: MediaType -> (ByteString, ByteString) -> MediaType
- mainType :: MediaType -> ByteString
- subType :: MediaType -> ByteString
- parameters :: MediaType -> Parameters
- (/?) :: MediaType -> ByteString -> Bool
- (/.) :: MediaType -> ByteString -> Maybe ByteString
Type and creation
An HTTP media type, consisting of the type, subtype, and parameters.
type Parameters = Map ByteString ByteString Source
MediaType parameters.
(//) :: ByteString -> ByteString -> MediaType Source
Builds a MediaType without parameters. Can produce an error if
either type is invalid.
(/:) :: MediaType -> (ByteString, ByteString) -> MediaType Source
Adds a parameter to a MediaType. Can produce an error if either
string is invalid.
Querying
mainType :: MediaType -> ByteString Source
Retrieves the main type of a MediaType.
subType :: MediaType -> ByteString Source
Retrieves the sub type of a MediaType.
parameters :: MediaType -> Parameters Source
Retrieves the parameters of a MediaType.
(/?) :: MediaType -> ByteString -> Bool Source
Evaluates if a MediaType has a parameter of the given name.
(/.) :: MediaType -> ByteString -> Maybe ByteString Source
Retrieves a parameter from a MediaType.