Copyright | Alej Cabrera 2015 |
---|---|
License | BSD-3 |
Maintainer | cpp.cabrera@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- data Env = Env {}
- type EnvMap k v = Map k v
- type ParamMap a = EnvMap Text (Maybe Text)
- data QueryParams
- data FormParams
- defaultEnv :: Env
- mkHeaders :: RequestHeaders -> Headers
- mkQParams :: Query -> QParams
- mkFParams :: ByteString -> Maybe [(Text, Maybe Text)]
- toEnv :: Request -> Env
- toEnvWithForm :: Request -> [(Text, Text)] -> Env
- toEnvRaw :: Request -> ByteString -> Env
Documentation
data QueryParams Source
data FormParams Source
defaultEnv :: Env Source
mkFParams :: ByteString -> Maybe [(Text, Maybe Text)] Source
Given a ByteString, constructs association list
toEnv :: Request -> Env Source
Construct an Env without parsing any form parameters This is ideal if you're not consuming any form data.
toEnvWithForm :: Request -> [(Text, Text)] -> Env Source
Construct an Env from a Request and an association list of form parameters
If a framework exposes parameters in this fashion (Spock, Scotty),
use this over toEnvRaw
. It's likely the framework consumes the
request body when data is sent along using content-type
'application/x-www-form-urlencoded'
toEnvRaw :: Request -> ByteString -> Env Source
Expects form data via request body ByteString This is appropriate if you're programming with raw Network.Wai NOTE: if you're expecting form data, and the form data is in an invalid format this will happily construct an Env with empty form data