Hoogle Search
Within LTS Haskell 24.58 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
setHeader :: HasHeaders a => CI ByteString -> ByteString -> a -> asnap-core Snap.Internal.Core Sets a header key-value-pair in a HasHeaders datatype. If a header with the same name already exists, it is overwritten with the new value. Example:
ghci> import qualified Snap.Types.Headers as H ghci> setHeader "Host" "localhost" H.empty H {unH = [("host","localhost")]} ghci> setHeader "Host" "127.0.0.1" it H {unH = [("host","127.0.0.1")]}
updateHeaders :: HasHeaders a => (Headers -> Headers) -> a -> asnap-core Snap.Internal.Core Modify the datatype's headers.
-
snap-core Snap.Internal.Http.Types A typeclass for datatypes which contain HTTP headers.
addHeader :: HasHeaders a => CI ByteString -> ByteString -> a -> asnap-core Snap.Internal.Http.Types Adds a header key-value-pair to the HasHeaders datatype. If a header with the same name already exists, the new value is appended to the headers list. Example:
ghci> import qualified Snap.Types.Headers as H ghci> addHeader "Host" "localhost" H.empty H {unH = [("host","localhost")]} ghci> addHeader "Host" "127.0.0.1" it H {unH = [("host","localhost,127.0.0.1")]}
deleteHeader :: HasHeaders a => CI ByteString -> a -> asnap-core Snap.Internal.Http.Types Clears a header value from a HasHeaders datatype. Example:
ghci> import qualified Snap.Types.Headers as H ghci> deleteHeader "Host" $ setHeader "Host" "localhost" H.empty H {unH = []}
getHeader :: HasHeaders a => CI ByteString -> a -> Maybe ByteStringsnap-core Snap.Internal.Http.Types Gets a header value out of a HasHeaders datatype. Example:
ghci> import qualified Snap.Types.Headers as H ghci> getHeader "Host" $ setHeader "Host" "localhost" H.empty Just "localhost"
listHeaders :: HasHeaders a => a -> [(CI ByteString, ByteString)]snap-core Snap.Internal.Http.Types Lists all the headers out of a HasHeaders datatype. If many headers came in with the same name, they will be catenated together. Example:
ghci> import qualified Snap.Types.Headers as H ghci> listHeaders $ setHeader "Host" "localhost" H.empty [("host","localhost")]
rqHeaders :: Request -> Headerssnap-core Snap.Internal.Http.Types Contains all HTTP Headers associated with this request. Example:
ghci> :set -XOverloadedStrings ghci> import qualified Snap.Test as T ghci> import qualified Data.Map as M ghci> rqHeaders `fmap` T.buildRequest (T.get "/foo/bar" M.empty) H {unH = [("host","localhost")]}
rspHeaders :: Response -> Headerssnap-core Snap.Internal.Http.Types No documentation available.
setHeader :: HasHeaders a => CI ByteString -> ByteString -> a -> asnap-core Snap.Internal.Http.Types Sets a header key-value-pair in a HasHeaders datatype. If a header with the same name already exists, it is overwritten with the new value. Example:
ghci> import qualified Snap.Types.Headers as H ghci> setHeader "Host" "localhost" H.empty H {unH = [("host","localhost")]} ghci> setHeader "Host" "127.0.0.1" it H {unH = [("host","127.0.0.1")]}