From 5b379067b2709a3e08132bbe3881efe95680c0ec Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 8 Sep 2013 16:52:56 +0200 Subject: [PATCH] Add warning about calling parseJsonBody twice --- yesod-core/Yesod/Core/Json.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yesod-core/Yesod/Core/Json.hs b/yesod-core/Yesod/Core/Json.hs index 84550605..d0c0b383 100644 --- a/yesod-core/Yesod/Core/Json.hs +++ b/yesod-core/Yesod/Core/Json.hs @@ -84,6 +84,10 @@ provideJson = provideRep . return . J.toJSON -- If you want the raw JSON value, just ask for a @'J.Result' -- 'J.Value'@. -- +-- Note that this function will consume the request body. As such, calling it +-- twice will result in a parse error on the second call, since the request +-- body will no longer be available. +-- -- /Since: 0.3.0/ parseJsonBody :: (MonadHandler m, J.FromJSON a) => m (J.Result a) parseJsonBody = do