Portability | Haskell 98 |
---|---|
Stability | experimental |
Maintainer | Niklas Broberg, nibro@cs.chalmers.se |
An interface to a request object as held in the HSP environment.
- data Request = Request {
- getParameterL :: String -> [String]
- getHeaders :: [(String, String)]
- getParameter :: Request -> String -> Maybe String
- getParameter_ :: Request -> String -> String
- readParameter :: Read a => Request -> String -> Maybe a
- readParameterL :: Read a => Request -> String -> [a]
- readParameter_ :: Read a => Request -> String -> a
Documentation
A record representing an interface to an HTTP request. This allows us to use many different underlying types for these requests, all we need is to supply conversions to this interface. This is useful for when we run as CGI, or when we run inside a server app.
Request | |
|
getParameter :: Request -> String -> Maybe StringSource
Get a parameter from the request query string (GET) or body (POST).
| Returns Nothing
if the parameter is not set.
getParameter_ :: Request -> String -> StringSource
Unsafe version of getParameter, essentially fromJust.(getParameter r) but throws a ParameterLookupFailed exception if the parameter is not set.
readParameterL :: Read a => Request -> String -> [a]Source
Return a list of values read from their string representations.
readParameter_ :: Read a => Request -> String -> aSource
Unsafe version of readParameter