Skip to content

Commit

Permalink
Sync changes in MockHttpServletResponse test fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Feb 17, 2021
1 parent 40661d6 commit 5b97c47
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ private String getCookieHeader(Cookie cookie) {
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));
}
Expand All @@ -391,6 +391,10 @@ private String getCookieHeader(Cookie cookie) {
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");
Expand Down

0 comments on commit 5b97c47

Please sign in to comment.