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

Safe HaskellSafe-Inferred

Network.HTTP.Media.MediaType

Contents

Description

Defines the media type types and functions.

Synopsis

Type and creation

data MediaType Source

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

(//) :: ByteString -> ByteString -> MediaTypeSource

Builds a MediaType without parameters. Can produce an error if either type is invalid.

(/:) :: MediaType -> (ByteString, ByteString) -> MediaTypeSource

Adds a parameter to a MediaType. Can produce an error if either string is invalid.

parse :: ByteString -> Maybe MediaTypeSource

Parses a media type header into a MediaType.

Querying

mainType :: MediaType -> ByteStringSource

Retrieves the main type of a MediaType.

subType :: MediaType -> ByteStringSource

Retrieves the sub type of a MediaType.

parameters :: MediaType -> ParametersSource

Retrieves the parameters of a MediaType.

(/?) :: MediaType -> ByteString -> BoolSource

Evaluates if a MediaType has a parameter of the given name.

(/.) :: MediaType -> ByteString -> Maybe ByteStringSource

Retrieves a parameter from a MediaType.