I am trying to update a cookie in finatra like this:
import com.twitter.finatra.Request
import com.twitter.finagle.Cookie
def updateCookie(req:Request, cookieName:String, newVal:String) = {
// I tried also:
// req.response.removeCookie(cookieName)
// req.response.addCookie(new Cookie(cookieName, newVal))
req.response.cookies.update(cookieName, new Cookie(cookieName, newVal))
}
but it is not working. The cookie value I obtain in the following request is always the old one. Does anyone have an idea of what I am doing wrong?
I found it, it was that the cookies were in two different paths. Setting the right path solved the problem.