http-media-0.8.1.1: Processing HTTP Content-Type and Accept headers

Safe Haskell | Safe-Inferred
Language | Haskell2010

Network.HTTP.Media.MediaType

Contents

- Type and creation
- Querying

Description

Defines the `MediaType` accept header with an `Accept` instance for use in content-type negotiation.

Synopsis

- data MediaType
- type Parameters = Map (CI ByteString) (CI ByteString)
- (//) :: ByteString -> ByteString -> MediaType
- (/:) :: MediaType -> (ByteString, ByteString) -> MediaType
- mainType :: MediaType -> CI ByteString
- subType :: MediaType -> CI ByteString
- parameters :: MediaType -> Parameters
- (/?) :: MediaType -> ByteString -> Bool
- (/.) :: MediaType -> ByteString -> Maybe (CI ByteString)

# Type and creation

data MediaType Source #

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

#### Instances

Instances details

IsString MediaType Source # |
Instance details Defined in Network.HTTP.Media.MediaType.Internal Methods fromString :: String -> MediaType Source #
Show MediaType Source # |
Instance details Defined in Network.HTTP.Media.MediaType.Internal Methods showsPrec :: Int -> MediaType -> ShowS Source # show :: MediaType -> String Source # showList :: [MediaType] -> ShowS Source #
Eq MediaType Source # |
Instance details Defined in Network.HTTP.Media.MediaType.Internal Methods (==) :: MediaType -> MediaType -> Bool Source # (/=) :: MediaType -> MediaType -> Bool Source #
Ord MediaType Source # |

Instance details

Defined in Network.HTTP.Media.MediaType.Internal

Methods

compare :: MediaType -> MediaType -> Ordering Source #

(<) :: MediaType -> MediaType -> Bool Source #

(<=) :: MediaType -> MediaType -> Bool Source #

(>) :: MediaType -> MediaType -> Bool Source #

(>=) :: MediaType -> MediaType -> Bool Source #

max :: MediaType -> MediaType -> MediaType Source #

min :: MediaType -> MediaType -> MediaType Source #

Accept MediaType Source # |
Instance details Defined in Network.HTTP.Media.MediaType.Internal Methods parseAccept :: ByteString -> Maybe MediaType Source # matches :: MediaType -> MediaType -> Bool Source # moreSpecificThan :: MediaType -> MediaType -> Bool Source # hasExtensionParameters :: Proxy MediaType -> Bool Source #
RenderHeader MediaType Source # |
Instance details Defined in Network.HTTP.Media.MediaType.Internal Methods renderHeader :: MediaType -> ByteString Source #

type Parameters = Map (CI ByteString) (CI 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 -> CI ByteString Source #

Retrieves the main type of a `MediaType`.

subType :: MediaType -> CI 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 (CI ByteString) Source #

Retrieves a parameter from a `MediaType`.