Quote ETag if not quoted in HttpHeaders#setETag
This aligns HttpHeaders with other places like ServletWebRequest and DefaultWebExchange where an ETag is accepted as input. It also allows us to remove quoting from places that delegate to HttpHeaders#setETag since it now does that internally. Closes gh-33412
This commit is contained in:
@@ -214,15 +214,15 @@ class HttpHeadersTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void illegalETagWithoutQuotes() {
|
||||
String eTag = "v2.6";
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> headers.setETag(eTag));
|
||||
void eTagWithoutQuotes() {
|
||||
headers.setETag("v2.6");
|
||||
assertThat(headers.getETag()).isEqualTo("\"v2.6\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
void illegalWeakETagWithoutLeadingQuote() {
|
||||
String etag = "W/v2.6\"";
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> headers.setETag(etag));
|
||||
void weakETagWithoutLeadingQuote() {
|
||||
headers.setETag("W/v2.6\"");
|
||||
assertThat(headers.getETag()).isEqualTo("\"W/v2.6\"\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user