yesod-core-1.1.8: Creation of type-safe, RESTful web applications.

Safe HaskellNone




Provides a parsed version of the raw Request data.


Request datatype

type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)])Source

A tuple containing both the POST parameters and submitted files.

data Request Source

The parsed request information.




reqGetParams :: [(Text, Text)]
reqCookies :: [(Text, Text)]
reqWaiRequest :: Request
reqLangs :: [Text]

Languages which the client supports.

reqToken :: Maybe Text

A random, session-specific token used to prevent CSRF attacks.

reqBodySize :: Word64

Size of the request body.

Note: in the presence of chunked request bodies, this value will be 0, even though data is available.

Convenience functions

languages :: GHandler s m [Text]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.

Yesod will seek the first language from the returned list matched with languages supporting by your application. This language will be used to render i18n templates. If a matching language is not found the default language will be used.

This is handled by parseWaiRequest (not exposed).

Lookup parameters

lookupGetParam :: Text -> GHandler s m (Maybe Text)Source

Lookup for GET parameters.

lookupCookie :: Text -> GHandler s m (Maybe Text)Source

Lookup for cookie data.

lookupFile :: Text -> GHandler s m (Maybe FileInfo)Source

Lookup for POSTed files.


lookupGetParams :: Text -> GHandler s m [Text]Source

Lookup for GET parameters.

lookupPostParams :: Text -> GHandler s m [Text]Source

Lookup for POST parameters.

lookupCookies :: Text -> GHandler s m [Text]Source

Lookup for cookie data.

lookupFiles :: Text -> GHandler s m [FileInfo]Source

Lookup for POSTed files.