diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index 29948be09..c76dc9658 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -724,7 +724,11 @@ invalidArgsI msg = do -- | Set the cookie on the client. setCookie :: MonadHandler m => SetCookie -> m () -setCookie = addHeaderInternal . AddCookie +setCookie sc = do + addHeaderInternal (DeleteCookie name path) + addHeaderInternal (AddCookie sc) + where name = setCookieName sc + path = maybe "/" id (setCookiePath sc) -- | Helper function for setCookieExpires value getExpires :: MonadIO m diff --git a/yesod-core/Yesod/Core/Types.hs b/yesod-core/Yesod/Core/Types.hs index f364f44a5..4128cc7b0 100644 --- a/yesod-core/Yesod/Core/Types.hs +++ b/yesod-core/Yesod/Core/Types.hs @@ -323,7 +323,7 @@ instance NFData ErrorResponse where ----- header stuff -- | Headers to be added to a 'Result'. data Header = - AddCookie SetCookie + AddCookie SetCookie | DeleteCookie ByteString ByteString | Header ByteString ByteString deriving (Eq, Show)