Provides a parsed version of the raw Request
data.
- type RequestBodyContents = ([(ParamName, ParamValue)], [(ParamName, FileInfo)])
- data Request = Request {
- reqGetParams :: [(ParamName, ParamValue)]
- reqCookies :: [(ParamName, ParamValue)]
- reqWaiRequest :: Request
- reqLangs :: [String]
- reqNonce :: Maybe String
- class Monad m => RequestReader m where
- data FileInfo = FileInfo {}
- waiRequest :: RequestReader m => m Request
- languages :: RequestReader m => m [String]
- lookupGetParam :: RequestReader m => ParamName -> m (Maybe ParamValue)
- lookupPostParam :: (MonadIO m, RequestReader m) => ParamName -> m (Maybe ParamValue)
- lookupCookie :: RequestReader m => ParamName -> m (Maybe ParamValue)
- lookupFile :: (MonadIO m, RequestReader m) => ParamName -> m (Maybe FileInfo)
- lookupGetParams :: RequestReader m => ParamName -> m [ParamValue]
- lookupPostParams :: RequestReader m => ParamName -> m [ParamValue]
- lookupCookies :: RequestReader m => ParamName -> m [ParamValue]
- lookupFiles :: RequestReader m => ParamName -> m [FileInfo]
- type ParamName = String
- type ParamValue = String
- type ParamError = String
Request datatype
type RequestBodyContents = ([(ParamName, ParamValue)], [(ParamName, FileInfo)])Source
A tuple containing both the POST parameters and submitted files.
The parsed request information.
Request | |
|
class Monad m => RequestReader m whereSource
The reader monad specialized for Request
.
RequestReader (GHandler sub master) |
Convenience functions
waiRequest :: RequestReader m => m RequestSource
Get the request's Request
value.
languages :: RequestReader m => m [String]Source
Get the list of supported languages supplied by the user.
Languages are determined based on the following three (in descending order of preference):
- The _LANG get parameter.
- The _LANG cookie.
- The _LANG user session variable.
- Accept-Language HTTP header.
This is handled by parseWaiRequest (not exposed).
Lookup parameters
lookupGetParam :: RequestReader m => ParamName -> m (Maybe ParamValue)Source
Lookup for GET parameters.
lookupPostParam :: (MonadIO m, RequestReader m) => ParamName -> m (Maybe ParamValue)Source
lookupCookie :: RequestReader m => ParamName -> m (Maybe ParamValue)Source
Lookup for cookie data.
lookupFile :: (MonadIO m, RequestReader m) => ParamName -> m (Maybe FileInfo)Source
Lookup for POSTed files.
Multi-lookup
lookupGetParams :: RequestReader m => ParamName -> m [ParamValue]Source
Lookup for GET parameters.
lookupPostParams :: RequestReader m => ParamName -> m [ParamValue]Source
Lookup for POST parameters.
lookupCookies :: RequestReader m => ParamName -> m [ParamValue]Source
Lookup for cookie data.
lookupFiles :: RequestReader m => ParamName -> m [FileInfo]Source
Lookup for POSTed files.
Parameter type synonyms
type ParamValue = StringSource
type ParamError = StringSource