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

Yesod.Request

Contents

Description

Provides a parsed version of the raw Request data.

Synopsis

Request datatype

type RequestBodyContents = ([(ParamName, ParamValue)], [(ParamName, FileInfo)])Source

A tuple containing both the POST parameters and submitted files.

data Request Source

The parsed request information.

Constructors

Request 

Fields

reqGetParams :: [(ParamName, ParamValue)]
 
reqCookies :: [(ParamName, ParamValue)]
 
reqWaiRequest :: Request
 
reqLangs :: [String]

Languages which the client supports.

reqNonce :: Maybe String

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

class Monad m => RequestReader m whereSource

The reader monad specialized for Request.

Instances

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.

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