ContentsIndex
Framework.Http.Vars
Description

This module contains functions to access HTTP GET and POST variables.

HTTP vars can be accessed in three ways.

I. If you need to get/set only several variables, you can use httpGetVar and its family. That requires HttpRequest as argument.

II. If you need this in controller, it's simpler to use _GET and its family. That is used as argument for asks.

III. If you need to get/set many HTTP variables, it's better to fetch a variables map (with getvars or postvars), and work with it (with getString or getFile).

Synopsis
_GET :: String -> ActionConfig -> String
_GET' :: String -> String -> ActionConfig -> String
_POST :: String -> ActionConfig -> String
_POST' :: String -> String -> ActionConfig -> String
getvars :: HttpRequest -> HttpVarsMap
postvars :: HttpRequest -> HttpVarsMap
getVar :: HttpVarsMap -> String -> Maybe HttpVar
getVar' :: HttpVarsMap -> String -> String -> HttpVar
getFile :: HttpVarsMap -> String -> Maybe HttpVar
getString :: HttpVarsMap -> String -> Maybe String
getString' :: HttpVarsMap -> String -> String -> String
httpGetVar' :: HttpRequest -> String -> String -> String
httpPostVar :: HttpRequest -> String -> Maybe String
httpPostVar' :: HttpRequest -> String -> String -> String
httpAddGetVar :: HttpRequest -> String -> String -> String
urlAddGetVar :: String -> String -> String -> String
Documentation
_GET :: String -> ActionConfig -> String

Get value of GET variable. Sample usage in controller:

 controller = do
     var <- asks (_GET "varname")
_GET'
:: StringVar name
-> StringDefault value
-> ActionConfig
-> String
Same as _GET, but with default value
_POST :: String -> ActionConfig -> String
Get value of POST variable (see notes for _GET)
_POST'
:: StringVar name
-> StringDefault value
-> ActionConfig
-> String
Same as _POST, but with default value
getvars :: HttpRequest -> HttpVarsMap
Get map of GET variables from request
postvars :: HttpRequest -> HttpVarsMap
Get map of POST variables from request
getVar
:: HttpVarsMap
-> StringVariable name
-> Maybe HttpVar
Get a variable from map
getVar'
:: HttpVarsMap
-> StringVariable name
-> StringDefault value
-> HttpVar
Get a variable from map, with default value
getFile
:: HttpVarsMap
-> StringVariable name
-> Maybe HttpVar
Get a file from map
getString
:: HttpVarsMap
-> StringVariable name
-> Maybe String
Get a string variable from map
getString'
:: HttpVarsMap
-> StringVariable name
-> StringDefault value
-> String
Same, but with default value
httpGetVar'
:: HttpRequest
-> StringVariable name
-> StringDefault value
-> String
Get string GET variable directly from request, with default value
httpPostVar :: HttpRequest -> String -> Maybe String
Get string POST variable directly from request
httpPostVar'
:: HttpRequest
-> StringVariable name
-> StringDefault value
-> String
Same, but with default value
httpAddGetVar
:: HttpRequest
-> StringVar name
-> StringVar value
-> String
Add GET var to given Request and return resulting URL
urlAddGetVar
:: StringURL
-> StringVar name
-> StringVar value
-> StringNew URL
Add GET variable to given URL
Produced by Haddock version 2.4.2