Browse Source

Sync changes in MockHttpServletResponse test fixture

See gh-26558
pull/26568/head
Sam Brannen 5 years ago
parent
commit
5b97c47fc4
  1. 6
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java

6
spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java

@ -378,10 +378,10 @@ public class MockHttpServletResponse implements HttpServletResponse { @@ -378,10 +378,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
buf.append("; Domain=").append(cookie.getDomain());
}
int maxAge = cookie.getMaxAge();
ZonedDateTime expires = (cookie instanceof MockCookie ? ((MockCookie) cookie).getExpires() : null);
if (maxAge >= 0) {
buf.append("; Max-Age=").append(maxAge);
buf.append("; Expires=");
ZonedDateTime expires = (cookie instanceof MockCookie ? ((MockCookie) cookie).getExpires() : null);
if (expires != null) {
buf.append(expires.format(DateTimeFormatter.RFC_1123_DATE_TIME));
}
@ -391,6 +391,10 @@ public class MockHttpServletResponse implements HttpServletResponse { @@ -391,6 +391,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
buf.append(headers.getFirst(HttpHeaders.EXPIRES));
}
}
else if (expires != null) {
buf.append("; Expires=");
buf.append(expires.format(DateTimeFormatter.RFC_1123_DATE_TIME));
}
if (cookie.getSecure()) {
buf.append("; Secure");

Loading…
Cancel
Save