Servant.API.Header

servant-0.20.2: A family of combinators for defining webservices APIs

Safe Haskell | None
Language | Haskell2010

Servant.API.Header

Synopsis

- type Header = Header' '[Optional, Strict]
- data Header' (mods :: [Type]) (sym :: Symbol) a

# Documentation

type Header = Header' '[Optional, Strict] #

Extract the given header's value as a value of type `a`. I.e. header sent by client, parsed by server.

Example:

    >>> newtype Referer = Referer Text deriving (Eq, Show)
    >>>
    >>> -- GET /view-my-referer
    >>> type MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] Referer

data Header' (mods :: [Type]) (sym :: Symbol) a #

#### Instances

Instances details

(KnownSymbol h, ToHttpApiData v) => AddHeader mods h v (Headers (fst ': rest) a) (Headers (Header' mods h v ': (fst ': rest)) a) # |
Instance details Defined in Servant.API.ResponseHeaders Methods addOptionalHeader :: ResponseHeader h v -> Headers (fst ': rest) a -> Headers (Header' mods h v ': (fst ': rest)) a
HasResponseHeader h a (Header' mods h a ': rest) # |
Instance details Defined in Servant.API.ResponseHeaders Methods hlistLookupHeader :: HList (Header' mods h a ': rest) -> ResponseHeader h a
HasLink sub => HasLink (Header' mods sym a :> sub :: Type) # |
Instance details Defined in Servant.Links Methods toLink :: (Link -> a0) -> Proxy (Header' mods sym a :> sub) -> Link -> MkLink (Header' mods sym a :> sub) a0 #
(FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h) => BuildHeadersTo (Header' mods h v ': xs) # |
Instance details Defined in Servant.API.ResponseHeaders Methods buildHeadersTo :: [Header] -> HList (Header' mods h v ': xs) #
(KnownSymbol h, GetHeadersFromHList rest, ToHttpApiData v) => GetHeaders' (Header' mods h v ': rest) # |
Instance details Defined in Servant.API.ResponseHeaders Methods getHeaders' :: Headers (Header' mods h v ': rest) a -> [Header]
type MkLink (Header' mods sym a :> sub :: Type) r # |
Instance details Defined in Servant.Links type MkLink (Header' mods sym a :> sub :: Type) r = MkLink sub r