Merge branch '6.1.x'
This commit is contained in:
commit
5fee796659
|
|
@ -1073,9 +1073,8 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|||
*/
|
||||
public void setETag(@Nullable String etag) {
|
||||
if (etag != null) {
|
||||
Assert.isTrue(etag.startsWith("\"") || etag.startsWith("W/"),
|
||||
"Invalid ETag: does not start with W/ or \"");
|
||||
Assert.isTrue(etag.endsWith("\""), "Invalid ETag: does not end with \"");
|
||||
Assert.isTrue(etag.startsWith("\"") || etag.startsWith("W/\""), "ETag does not start with W/\" or \"");
|
||||
Assert.isTrue(etag.endsWith("\""), "ETag does not end with \"");
|
||||
set(ETAG, etag);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -214,11 +214,17 @@ class HttpHeadersTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
void illegalETag() {
|
||||
void illegalETagWithoutQuotes() {
|
||||
String eTag = "v2.6";
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> headers.setETag(eTag));
|
||||
}
|
||||
|
||||
@Test
|
||||
void illegalWeakETagWithoutLeadingQuote() {
|
||||
String etag = "W/v2.6\"";
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> headers.setETag(etag));
|
||||
}
|
||||
|
||||
@Test
|
||||
void ifMatch() {
|
||||
String ifMatch = "\"v2.6\"";
|
||||
|
|
|
|||
Loading…
Reference in New Issue