iterio-server-0.3: Library for building servers with IterIO

Safe HaskellSafe



Defines the Action monad which abstracts some of the details of handling HTTP requests with IterIO.



type Action t b m a = StateT (ActionState t b m) m aSource

A StateT monad in which requests can be handled. It keeps track of the HttpReq, the form parameters from the request body and an HttpResp used to reply to the client.

data ActionState t b m Source



data Param Source

A request parameter from a form field in the HTTP body




paramKey :: ByteString
paramValue :: ByteString
paramHeaders :: [(ByteString, ByteString)]

Header of a multipart/form-data post


params :: Monad m => Action t b m [Param]Source

Returns a list of all Params.

param :: Monad m => ByteString -> Action t b m (Maybe Param)Source

Returns the Param corresponding to the specified key or Nothing if one is not present in the request.

paramVal :: Monad m => ByteString -> Action t b m ByteStringSource

Force get parameter value

paramValM :: Monad m => (ByteString -> a) -> ByteString -> Action t b m (Maybe a)Source

Get (maybe) paramater value and transform it with f

setParams :: Monad m => [Param] -> Action t b m [Param]Source

Set the list of Params.

getBody :: Monad m => Action t b m bSource

Returns the body of the current request.

getHttpReq :: Monad m => Action t b m (HttpReq t)Source

Returns the HttpReq for the current request.

setSession :: Monad m => String -> Action t b m ()Source

Sets a the value for "_sess" in the cookie to the given string.

destroySession :: Monad m => Action t b m ()Source

Removes the "_sess" key-value pair from the cookie.

requestHeader :: Monad m => ByteString -> Action t b m (Maybe ByteString)Source

Returns the value of an Http Header from the request if it exists otherwise Nothing