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.
sHead :: forall a (t :: [a]) . Sing t -> Sing (Apply (HeadSym0 :: TyFun [a] a -> Type) t)singletons-base Prelude.Singletons No documentation available.
-
snap-core Snap.Core A typeclass for datatypes which contain HTTP headers.
addHeader :: HasHeaders a => CI ByteString -> ByteString -> a -> asnap-core Snap.Core 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.Core 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.Core 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"
ipHeaderFilter :: MonadSnap m => m ()snap-core Snap.Core Modifies the Request in the state to set the rqRemoteAddr field to the value in the X-Forwarded-For header. If the header is not present, this action has no effect. This action should be used only when working behind a reverse http proxy that sets the X-Forwarded-For header. This is the only way to ensure the value in the X-Forwarded-For header can be trusted. This is provided as a filter so actions that require the remote address can get it in a uniform manner. It has specifically limited functionality to ensure that its transformation can be trusted, when used correctly.
ipHeaderFilter' :: MonadSnap m => CI ByteString -> m ()snap-core Snap.Core Modifies the Request in the state to set the rqRemoteAddr field to the value from the header specified. If the header specified is not present, this action has no effect. This action should be used only when working behind a reverse http proxy that sets the header being looked at. This is the only way to ensure the value in the header can be trusted. This is provided as a filter so actions that require the remote address can get it in a uniform manner. It has specifically limited functionality to ensure that its transformation can be trusted, when used correctly.
listHeaders :: HasHeaders a => a -> [(CI ByteString, ByteString)]snap-core Snap.Core 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.Core 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")]}
setHeader :: HasHeaders a => CI ByteString -> ByteString -> a -> asnap-core Snap.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")]}