Are you having trouble deleting a cookie from Lift? I burned too much time yesterday night tracking down this lift bug (which was compounded by a bug in Chrome's developer window). I am documenting my experience here so maybe the next person to encounter this will get more sleep than I got.
For instance, if you used the following to set a cookie:
S.addCookie(HTTPCookie("name", Full("value"), Full(".photopoly.ca"), Full("/"), Full(86400), Empty, Empty))
and later you tried to delete this cookie:
S.deleteCookie("name")
Then you would be disappointed with the result. You'd also be disappointed if you tried
S.findCookie("name").map(S.deleteCookie)
I worked around the problem by explicitly adding a new cookie to wipe out the old cookie (which is basically what S.deleteCookie does -- but the secret is to pass in the same path and domain you used to set the cookie):
S.addCookie(HTTPCookie("name", Full(""), Full(".photopoly.ca"), Full("/"), Full(0), Empty, Empty))
Maybe a future version of Lift will have
S.deleteCookie(name: String, domain: Box[String], path: Box[String])
S.deleteCookie(name: String, domain: Box[String], path: Box[String])
No comments:
Post a Comment