| Portability | so-so |
|---|---|
| Stability | provisional |
| Maintainer | Sigbjorn Finne <sof@forkIO.com> |
Web.Utils.Post
Description
Working with POSTed form payloads.
- data PostReq = PostReq {}
- data PostKind
- = PostQuery
- | PostWWWForm
- | PostFormData
- newPostRequest :: String -> PostReq
- testRequest :: PostReq -> Maybe PostKind -> IO ()
- toRequest :: PostReq -> Maybe PostKind -> IO (String, [(String, String)], String)
- toAmpString :: [PostParam] -> String
- mustBeBody :: PostParam -> Bool
- mustBeQuery :: PostParam -> Bool
- addNameValue :: String -> String -> PostReq -> PostReq
- addQueryNameValue :: String -> String -> PostReq -> PostReq
- addBodyNameValue :: String -> String -> PostReq -> PostReq
- addNameFile :: String -> FilePath -> Maybe String -> PostReq -> PostReq
- data PostParam
- isPostFile :: PostParam -> Bool
- toMIMEValue :: [PostParam] -> IO MIMEValue
- fromPostParam :: String -> PostParam -> IO MIMEValue
- toMIMEType :: String -> IO Type
- getMIMEType :: String -> IO Type
Documentation
Constructors
| PostQuery | |
| PostWWWForm | |
| PostFormData |
toAmpString :: [PostParam] -> StringSource
mustBeBody :: PostParam -> BoolSource
mustBeQuery :: PostParam -> BoolSource
addNameValue :: String -> String -> PostReq -> PostReqSource
addNameValue nm val req augments the request req with a binding for (nm,val). Neither nm nor val are assumed encoded. It leaves it until the serialization phase to fix on how to communicate the binding for the POST request (i.e., via the query portion or in the request's body.)
addQueryNameValue :: String -> String -> PostReq -> PostReqSource
addQueryNameValue nm val req performs same function as addNameValue, but adds the constraint that the binding must be transmitted as part of the query portion of the URL it ends up going out via.
addBodyNameValue :: String -> String -> PostReq -> PostReqSource
addQueryNameValue nm val req performs same function as addNameValue, but adds the constraint that the binding must be transmitted as part of the body of the POST request, forcing the payload to be of MIME type application/x-www-form-urlencoded
addNameFile :: String -> FilePath -> Maybe String -> PostReq -> PostReqSource
addNameFile nm fb mbMimeType req augments the request req with a binding of name nm to the local file fb. It will be slurped in and included in the POST request, as part of a multi-part payload.
isPostFile :: PostParam -> BoolSource
toMIMEValue :: [PostParam] -> IO MIMEValueSource
toMIMEType :: String -> IO TypeSource
getMIMEType :: String -> IO TypeSource