-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Preserve expires attribute in MockCookie #23769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
At present, MockCookie doesn't preserve expires attribute. This has a consequence that cookie value set using MockHttpServletResponse#addHeader containing expires attribute will not match the cookie value obtained from MockHttpServletResponse#getHeader since the expires will get calculated based on current time. This commit enhances MockCookie to preserve expires attribute.
Any feedback on this? The current behavior, illustrated by test in the opening comment, is effectively a bug. |
Sorry for the delayed response. This one slipped under the radar. It looks legit to me, so we'll try to get this in for 5.1.11 and 5.2.1. |
For future reference, please wrap commit message descriptions at 72 characters. |
Also, the imports in |
At present, MockCookie doesn't preserve expires attribute. This has a consequence that a cookie value set using MockHttpServletResponse#addHeader containing an expires attribute will not match the cookie value obtained from MockHttpServletResponse#getHeader, since the expires attribute will get calculated based on current time. This commit enhances MockCookie to preserve the expires attribute. Closes gh-23769
Thanks for taking care of this @sbrannen! 👍 |
At present,
MockCookie
doesn't preserve expires attribute. This has a consequence that cookie value set usingMockHttpServletResponse#addHeader
containing expires attribute will not match the cookie value obtained fromMockHttpServletResponse#getHeader
since the expires will get calculated based on current time.This is very simple to demonstrate using a test that's added to
MockHttpServletResponseTests
as a part of this PR:This PR enhances
MockCookie
to preserve expires attribute.