[web-devel] WAI, HTTP POST , POST request body extract

Антон Чешков acheshkov at gmail.com
Sun Mar 6 20:46:28 CET 2011


I have found myself. It is example to extract all Request POST data and
return it in Response


*import qualified Data.ByteString.Char8 as C*
*import Network.Wai.Parse (parseRequestBody, lbsSink)*

*main = run 3000 app*
*
*
*app req = do*
*  (params, _) <- parseRequestBody lbsSink req*
*  let r = C.concat $ map (\(x,y) -> C.concat [x,y]) params*
*  return $ ResponseBuilder *
*      status200*
*      [("Content-Type", "text/plain")]*
*      $ copyByteString r*

2011/3/6 Антон Чешков <acheshkov at gmail.com>

> Hi Michael. Please explain how to extract POST data from WAI Request.
>
> Thanks.
>
> --
> Best regards,
> Cheshkov Anton
> Phone: +7 909 005 18 82
> Skype: cheshkov_anton
>



-- 
Best regards,
Cheshkov Anton
Phone: +7 909 005 18 82
Skype: cheshkov_anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110307/c5a9824f/attachment.htm>


More information about the web-devel mailing list