Add and export getPostParams function

This commit is contained in:
Sibi Prabakaran 2017-02-17 00:18:17 +05:30
parent 4327dac8a7
commit 797278243e
No known key found for this signature in database
GPG Key ID: D19E3E0EBB557613

View File

@ -31,6 +31,7 @@ module Yesod.Core.Handler
, getsYesod
, getUrlRender
, getUrlRenderParams
, getPostParams
, getCurrentRoute
, getRequest
, waiRequest
@ -339,6 +340,18 @@ getUrlRenderParams
=> m (Route (HandlerSite m) -> [(Text, Text)] -> Text)
getUrlRenderParams = rheRender <$> askHandlerEnv
-- | Get all the post parameters passed to the handler. To also get
-- the submitted files (if any), you have to use 'runRequestBody'
-- instead of this function.
--
-- @since 1.4.33
getPostParams
:: MonadHandler m
=> m [(Text, Text)]
getPostParams = do
reqBodyContent <- runRequestBody
return $ fst reqBodyContent
-- | Get the route requested by the user. If this is a 404 response- where the
-- user requested an invalid route- this function will return 'Nothing'.
getCurrentRoute :: MonadHandler m => m (Maybe (Route (HandlerSite m)))