Just to clarify one point: you don't need to include the ?, :, or & characters in the parameters to urlEncodedBody; urlEncodedBody will automatically add the ? and &, and I'm guessing the colon was just a typo. In other words, the following code is probably closer to what you were looking for:

let request = urlEncodedBody [("nonce", "2"), ("method", "getInfo")] r


On Wed, May 28, 2014 at 4:21 PM, Miro Karpis <miroslav.karpis@gmail.com> wrote:
so this did the trick:

test :: IO ()
test = do
  r <- parseUrl $ "http://localhost:3000/readbody
  let r_ = urlEncodedBody [("?nonce:", "2"), ("&method", "getInfo")] r
  let request = r_
        { requestBody = (RequestBodyBS s)}

  response <- withManager $ httpLbs request
  putStrLn $ show request
  print $ responseBody response


On Wed, May 28, 2014 at 2:48 PM, Miro Karpis <miroslav.karpis@gmail.com> wrote:
Hi, I'm having difficulties with sending body parameters/values in a POST request. It seems that the server does not receive in body.

ideas/comments very welcome ;-)

cheers,
m.


{-# LANGUAGE OverloadedStrings #-}
 
import Network.HTTP.Conduit
import Data.Word(Word8)
import Data.ByteString.Lazy(pack)
import qualified Data.ByteString.Char8 as B

x :: B.ByteString
x = "?value=10" 

post = do
putStrLn $show r
let request = r 
{ secure = True
, method = "POST"
, requestBody = RequestBodyBS s
, requestHeaders = (requestHeaders r) ++ [("Content-Type", "application/json")]}
putStrLn $ show request
response <- withManager $ httpLbs request
print $ responseBody response



_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners