对不起,如果这是错误的地方.
根据定义的http规范:http://tools.ietf.org/html/rfc7232#section-3.3
如果接收的字段值不是有效的HTTP日期,或者请求方法既不是GET也不是HEAD,则接收方必须忽略If-Modified-Since标头字段.
Spring Boot没有这样做.它抛出一个IllegalArgumentException,它不会被检查标头值的代码处理.
以下是org.springframework.http.HttpHeaders.java中的转换代码
/**
* Return the value of the {@code If-Modified-Since} header.
* <p>The date is returned as the number of milliseconds since
* January 1, 1970 GMT. Returns -1 when the date is unknown.
*/
public long getIfModifiedSince() {
return getFirstDate(IF_MODIFIED_SINCE);
}
/**
* Parse the first header value for the given header name as a date,
* return -1 if there is no value, or raise {@link IllegalArgumentException}
* if the …Run Code Online (Sandbox Code Playgroud)