diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index 65b3abf9d..9222ac99e 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod-core +## 1.6.9 + +* Add `sendResponseNoContent` [#1565](https://github.com/yesodweb/yesod/pull/1565) + ## 1.6.8.1 * Add missing test file to tarball [#1563](https://github.com/yesodweb/yesod/issues/1563) diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index 83d0af79c..2bd720e46 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -99,6 +99,7 @@ module Yesod.Core.Handler -- ** Type specific response with custom status , sendStatusJSON , sendResponseCreated + , sendResponseNoContent , sendWaiResponse , sendWaiApplication , sendRawResponse @@ -648,6 +649,12 @@ sendResponseCreated url = do r <- getUrlRender handlerError $ HCCreated $ r url +-- | Bypass remaining handler code and output no content with a 204 status code. +-- +-- @since 1.6.9 +sendResponseNoContent :: MonadHandler m => m a +sendResponseNoContent = sendWaiResponse $ W.responseBuilder H.status204 [] mempty + -- | Send a 'W.Response'. Please note: this function is rarely -- necessary, and will /disregard/ any changes to response headers and session -- that you have already specified. This function short-circuits. It should be diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 0336d16d7..e6486da32 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.6.8.1 +version: 1.6.9 license: MIT license-file: LICENSE author: Michael Snoyman