Skip to content

Commit

Permalink
Merge pull request #1258 from bitemyapp/master
Browse files Browse the repository at this point in the history
What I did to avoid the duplicate cookie problem
  • Loading branch information
MaxGabriel committed Aug 14, 2016
2 parents cc6cc29 + a3f4974 commit 9fb876e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion yesod-core/Yesod/Core/Handler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion yesod-core/Yesod/Core/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9fb876e

Please sign in to comment.