#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ >= 702)
#endif
module Data.IterIO.Http.Support.Utils where
import Data.ByteString.Lazy.Char8
import Data.IterIO
import Data.IterIO.Http
import Data.IterIO.Http.Support.Action
parseParams :: Monad m => Action t ByteString m [Param]
parseParams = do
req <- getHttpReq
body <- getBody
prms0 <- params
prms1 <- parseParams' req body
setParams $ prms1 ++ prms0
parseParams' :: Monad m => HttpReq a -> ByteString -> m [Param]
parseParams' req body = inumPure body |$ foldForm req handle []
where handle accm field = do
val <- pureI
return $ (Param (ffName field) val (ffHeaders field)):accm