1

I don't seem to be able to capture request body any more. Everything started here when I hit the problem after an update. I was trying to investigate it and got to a point where I cant get the request body niether with scotty's body function nor with Network.WAI functions on which Scotty builds. I could probably parse the json body myself only if I could get it.

I am trying this and it does not work. I just get an empty bytestring.

import qualified Data.ByteString.Char8 as C
import           Control.Monad.Trans (liftIO)
import           Web.Scotty.Trans
import           Network.Wai (requestBody)

loginUser :: ActionD ()
loginUser = do
  r <- request
  b <- liftIO $ requestBody r
  if C.null b then error "Empty" else error ("Body: " ++ (C.unpack b))

So what am I doing wrong to catch the request body? What changes have been made to Scotty recently so that it stop working as usual?

Thanks

Community
  • 1
  • 1
r.sendecky
  • 9,933
  • 9
  • 34
  • 62
  • Are you building from cabal sandbox or global packages? Which versions of scotty, wai and warp are you currently building against? On which platform? – shang Sep 19 '14 at 01:58
  • @shang Building on Arch Linux. All package versions are the latest cabal update pool. Building in sandbox. – r.sendecky Sep 19 '14 at 05:26

0 Answers0