Reputation: 2653
For debugging, I'd like to see raw request bodies that are being sent to my yesod application.
I know how to use runRequestBody
https://www.stackage.org/haddock/lts-7.0/yesod-core-1.4.24/Yesod-Core-Handler.html#v:runRequestBody
Now there is rawRequestBody
. I am using
rawRequestBody Data.Conduit.$$ Data.Conduit.List.consume
inside defaultLayout
but the result is always empty.
The actual representation is a Conduit, so I suspect that it is already drained at this point. Then when do I get to see this in a state where it holds data? Assume this is possible, then how can I read it without removing its contents?
Upvotes: 2
Views: 346
Reputation: 597
Try this
import qualified Data.Conduit.Text as CT
import qualified Data.Conduit.List as CL
rawRequestBody $$ CT.decode CT.utf8 =$ CL.consume
Upvotes: 0