diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index 0c37ac75..557c87fa 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -53,7 +53,9 @@ module Yesod.Core.Handler , lookupPostParams , lookupCookies , lookupFiles - -- * Special responses + -- * Responses + -- ** Pure + , respond -- ** Streaming , respondSource , sendChunk @@ -915,6 +917,14 @@ rawRequestBody = do fileSource :: MonadResource m => FileInfo -> Source m S.ByteString fileSource = transPipe liftResourceT . fileSourceRaw +-- | Provide a pure value for the response body. +-- +-- > respond ct = return . TypedContent ct . toContent +-- +-- Since 1.2.0 +respond :: (Monad m, ToContent a) => ContentType -> a -> m TypedContent +respond ct = return . TypedContent ct . toContent + -- | Use a @Source@ for the response body. -- -- Note that, for ease of use, the underlying monad is a @HandlerT@. This