Support cookie w/ only Expires attribute in MockHttpServletResponse
Prior to this commit, MockHttpServletResponse only included the Expires attribute in the generated Cookie header if the Max-Age attribute had also been set. This commit supports including the Expires attribute in the generated Cookie Header even when the Max-Age attribute has not been set. Closes gh-26558
This commit is contained in:
committed by
Sam Brannen
parent
e17ca9a4e9
commit
40661d62c1
@@ -475,6 +475,17 @@ class MockHttpServletResponseTests {
|
||||
assertThat(header).startsWith("SESSION=123; Path=/; Max-Age=100; Expires=");
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 5.1.12
|
||||
*/
|
||||
@Test
|
||||
void addCookieHeaderWithOnlyExpiresAttribute() {
|
||||
String cookieValue = "SESSION=123; Path=/; Expires=Tue, 8 Oct 2019 19:50:00 GMT";
|
||||
response.addHeader(SET_COOKIE, cookieValue);
|
||||
assertNumCookies(1);
|
||||
assertThat(response.getHeader(SET_COOKIE)).isEqualTo(cookieValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
void addCookie() {
|
||||
MockCookie mockCookie = new MockCookie("SESSION", "123");
|
||||
|
||||
Reference in New Issue
Block a user