Fix #9685 Date is not a content header (#9687)

resetContent does not reset Date Header

Signed-off-by: gregw <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2023-04-29 13:36:12 +02:00 committed by GitHub
parent 96d2977942
commit cba1fd6930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -1253,7 +1253,6 @@ public class Response implements HttpServletResponse
case LAST_MODIFIED:
case EXPIRES:
case ETAG:
case DATE:
case VARY:
i.remove();
continue;

View File

@ -154,6 +154,7 @@ public class ErrorHandlerTest
assertThat("Response status code", response.getStatus(), is(404));
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), greaterThan(0));
assertThat("Response Content-Type", response.get(HttpHeader.CONTENT_TYPE), containsString("text/html;charset=ISO-8859-1"));
assertThat(response.get(HttpHeader.DATE), notNullValue());
assertThat(response.getContent(), containsString("content=\"text/html;charset=ISO-8859-1\""));
assertContent(response);

View File

@ -2090,6 +2090,7 @@ public class ResponseTest
response.setContentType("some/type");
response.setContentLength(3);
response.setHeader(HttpHeader.EXPIRES, "never");
response.setHeader(HttpHeader.DATE, "2000-01-01");
response.setHeader("SomeHeader", "SomeValue");
@ -2106,6 +2107,7 @@ public class ResponseTest
// check arbitrary header still set
assertThat(response.getHeader("SomeHeader"), is("SomeValue"));
assertThat(response.getHeader("Date"), is("2000-01-01"));
// check cookies are still there
Enumeration<String> set = response.getHttpFields().getValues("Set-Cookie");