Add space before cookie attributes
According to RFC-6265 that there should be a space between the ; and the attribute name, i.e. the header should be something like name=value; Domain=localhost; HttpOnly rather than name=value;Domain=localhost;HttpOnly Issue: SPR-15225
This commit is contained in:
@@ -328,25 +328,25 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(cookie.getName()).append('=').append(cookie.getValue() == null ? "" : cookie.getValue());
|
||||
if (StringUtils.hasText(cookie.getPath())) {
|
||||
buf.append(";Path=").append(cookie.getPath());
|
||||
buf.append("; Path=").append(cookie.getPath());
|
||||
}
|
||||
if (StringUtils.hasText(cookie.getDomain())) {
|
||||
buf.append(";Domain=").append(cookie.getDomain());
|
||||
buf.append("; Domain=").append(cookie.getDomain());
|
||||
}
|
||||
int maxAge = cookie.getMaxAge();
|
||||
if (maxAge >= 0) {
|
||||
buf.append(";Max-Age=").append(maxAge);
|
||||
buf.append(";Expires=");
|
||||
buf.append("; Max-Age=").append(maxAge);
|
||||
buf.append("; Expires=");
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setExpires(maxAge > 0 ? System.currentTimeMillis() + 1000L * maxAge : 0);
|
||||
buf.append(headers.getFirst(HttpHeaders.EXPIRES));
|
||||
}
|
||||
|
||||
if (cookie.getSecure()) {
|
||||
buf.append(";Secure");
|
||||
buf.append("; Secure");
|
||||
}
|
||||
if (cookie.isHttpOnly()) {
|
||||
buf.append(";HttpOnly");
|
||||
buf.append("; HttpOnly");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user