snap-core-0.9.3.1: Snap: A Haskell Web Framework (core interfaces and types)

Safe Haskell | None

Snap.Types.Headers

Contents

- Headers type
- Headers creation
- Predicates
- Lookup
- Adding/setting headers
- Deleting
- Traversal
- Lists

Description

An opaque data type for HTTP headers. Intended to be imported qualified, i.e:

     import           Snap.Types.Headers (Headers)
     import qualified Snap.Types.Headers as H

     foo :: Headers
     foo = H.empty

Synopsis

- data Headers
- empty :: Headers
- null :: Headers -> Bool
- member :: CI ByteString -> Headers -> Bool
- lookup :: CI ByteString -> Headers -> Maybe [ByteString]
- lookupWithDefault :: ByteString -> CI ByteString -> Headers -> [ByteString]
- insert :: CI ByteString -> ByteString -> Headers -> Headers
- set :: CI ByteString -> ByteString -> Headers -> Headers
- delete :: CI ByteString -> Headers -> Headers
- fold :: (a -> CI ByteString -> [ByteString] -> a) -> a -> Headers -> a
- toList :: Headers -> [(CI ByteString, ByteString)]
- fromList :: [(CI ByteString, ByteString)] -> Headers

# Headers type

data Headers

Instances

Show Headers |
HasHeaders Headers |

# Headers creation

empty :: Headers

# Predicates

null :: Headers -> Bool

member :: CI ByteString -> Headers -> Bool

# Lookup

lookup :: CI ByteString -> Headers -> Maybe [ByteString]

lookupWithDefault :: ByteString -> CI ByteString -> Headers -> [ByteString]

# Adding/setting headers

insert :: CI ByteString -> ByteString -> Headers -> Headers

set :: CI ByteString -> ByteString -> Headers -> Headers

# Deleting

delete :: CI ByteString -> Headers -> Headers

# Traversal

fold :: (a -> CI ByteString -> [ByteString] -> a) -> a -> Headers -> a

# Lists

toList :: Headers -> [(CI ByteString, ByteString)]

fromList :: [(CI ByteString, ByteString)] -> Headers