servant-0.18.3: A family of combinators for defining webservices APIs
Safe HaskellNone
LanguageHaskell2010

Servant.API.Header

Synopsis

Documentation

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

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 :: [*]) (sym :: Symbol) (a :: *) Source #

Instances

Instances details
(KnownSymbol h, ToHttpApiData v) => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': (fst ': rest)) a) Source # 
Instance details

Defined in Servant.API.ResponseHeaders

Methods

addOptionalHeader :: ResponseHeader h v -> Headers (fst ': rest) a -> Headers (Header h v ': (fst ': rest)) a

HasResponseHeader h a (Header h a ': rest) Source # 
Instance details

Defined in Servant.API.ResponseHeaders

Methods

hlistLookupHeader :: HList (Header h a ': rest) -> ResponseHeader h a

HasLink sub => HasLink (Header' mods sym a :> sub :: Type) Source # 
Instance details

Defined in Servant.Links

Associated Types

type MkLink (Header' mods sym a :> sub) a Source #

Methods

toLink :: (Link -> a0) -> Proxy (Header' mods sym a :> sub) -> Link -> MkLink (Header' mods sym a :> sub) a0 Source #

(KnownSymbol h, GetHeadersFromHList rest, ToHttpApiData v) => GetHeaders' (Header h v ': rest) Source # 
Instance details

Defined in Servant.API.ResponseHeaders

Methods

getHeaders' :: Headers (Header h v ': rest) a -> [Header0]

(FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h) => BuildHeadersTo (Header h v ': xs) Source # 
Instance details

Defined in Servant.API.ResponseHeaders

Methods

buildHeadersTo :: [Header0] -> HList (Header h v ': xs) Source #

type MkLink (Header' mods sym a :> sub :: Type) r Source # 
Instance details

Defined in Servant.Links

type MkLink (Header' mods sym a :> sub :: Type) r = MkLink sub r