Add back sendResponseCreated

This commit is contained in:
Michael Snoyman 2010-12-04 19:07:11 +02:00
parent 7cf5609009
commit 610529d7bf
2 changed files with 9 additions and 1 deletions

View File

@ -50,6 +50,7 @@ module Yesod.Handler
, sendFile , sendFile
, sendResponse , sendResponse
, sendResponseStatus , sendResponseStatus
, sendResponseCreated
-- * Setting headers -- * Setting headers
, setCookie , setCookie
, deleteCookie , deleteCookie
@ -441,6 +442,13 @@ sendResponseStatus :: HasReps c => W.Status -> c -> GHandler s m a
sendResponseStatus s = GHandler . lift . throwMEither . HCContent s sendResponseStatus s = GHandler . lift . throwMEither . HCContent s
. chooseRep . chooseRep
-- | Send a 201 "Created" response with the given route as the Location
-- response header.
sendResponseCreated :: Route m -> GHandler s m a
sendResponseCreated url = do
r <- getUrlRender
GHandler $ lift $ throwMEither $ HCCreated $ r url
-- | Return a 404 not found page. Also denotes no handler available. -- | Return a 404 not found page. Also denotes no handler available.
notFound :: Failure ErrorResponse m => m a notFound :: Failure ErrorResponse m => m a
notFound = failure NotFound notFound = failure NotFound

View File

@ -1,5 +1,5 @@
name: yesod name: yesod
version: 0.6.5 version: 0.6.6
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>