Safe Haskell | None |
---|---|
Language | Haskell2010 |
Serv.Internal.Server.Context
- data Context = Context {
- request :: Request
- pathZipper :: ([Text], [Text])
- headersExpected :: [(HeaderName, Maybe Text)]
- config :: Config
- body :: ByteString
- corsPolicies :: [Policy]
- corsHeaders :: (HeadersExpectedOf methods, HeadersReturnedBy methods, VerbsOf methods) => Proxy methods -> Bool -> Context -> Maybe [Header]
- makeContext :: Config -> Request -> IO Context
- pathIsEmpty :: Context -> Bool
- method :: Context -> Method
- requestHeadersSeen :: Context -> Set HeaderName
- takeAllSegments :: Context -> (Context, [Text])
- takeSegment :: Context -> (Context, Maybe Text)
- stepContext :: Context -> Context
- pullHeaderRaw :: HeaderName -> Context -> (Context, Maybe ByteString)
- examineHeader :: HeaderDecode n a => Proxy n -> Context -> (Context, Either String a)
- examineHeaderFast :: HeaderDecode n a => Proxy n -> Context -> Maybe a
- expectHeader :: ReflectName n => Proxy n -> Text -> Context -> (Context, Bool)
- safeHead :: [a] -> Maybe a
Documentation
Constructors
Context | |
Fields
|
corsHeaders :: (HeadersExpectedOf methods, HeadersReturnedBy methods, VerbsOf methods) => Proxy methods -> Bool -> Context -> Maybe [Header] Source #
pathIsEmpty :: Context -> Bool Source #
takeSegment :: Context -> (Context, Maybe Text) Source #
Pop a segment off the URI and produce a new context for "beyond" that segment
stepContext :: Context -> Context Source #
Move the context down the URI segment listing one step if possible.
pullHeaderRaw :: HeaderName -> Context -> (Context, Maybe ByteString) Source #
Pull a Header raw from the context, updating it to note that we looked
examineHeader :: HeaderDecode n a => Proxy n -> Context -> (Context, Either String a) Source #
Pull a header value from the context, updating it to note that we looked
examineHeaderFast :: HeaderDecode n a => Proxy n -> Context -> Maybe a Source #
Sort of like examineHeader
but used for when we just want the value
and don't care about updating the context or worrying about
distinguishing between decoding failure and outright not being there at
all!
expectHeader :: ReflectName n => Proxy n -> Text -> Context -> (Context, Bool) Source #
Match a header value in the context, updating it to show that we looked