File tree 2 files changed +9
-4
lines changed
main/java/org/springframework/http
test/java/org/springframework/http
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1073,9 +1073,8 @@ public long getDate() {
1073
1073
*/
1074
1074
public void setETag (@ Nullable String etag ) {
1075
1075
if (etag != null ) {
1076
- Assert .isTrue (etag .startsWith ("\" " ) || etag .startsWith ("W/" ),
1077
- "Invalid ETag: does not start with W/ or \" " );
1078
- Assert .isTrue (etag .endsWith ("\" " ), "Invalid ETag: does not end with \" " );
1076
+ Assert .isTrue (etag .startsWith ("\" " ) || etag .startsWith ("W/\" " ), "ETag does not start with W/\" or \" " );
1077
+ Assert .isTrue (etag .endsWith ("\" " ), "ETag does not end with \" " );
1079
1078
set (ETAG , etag );
1080
1079
}
1081
1080
else {
Original file line number Diff line number Diff line change @@ -214,11 +214,17 @@ void ipv6Host() {
214
214
}
215
215
216
216
@ Test
217
- void illegalETag () {
217
+ void illegalETagWithoutQuotes () {
218
218
String eTag = "v2.6" ;
219
219
assertThatIllegalArgumentException ().isThrownBy (() -> headers .setETag (eTag ));
220
220
}
221
221
222
+ @ Test
223
+ void illegalWeakETagWithoutLeadingQuote () {
224
+ String etag = "W/v2.6\" " ;
225
+ assertThatIllegalArgumentException ().isThrownBy (() -> headers .setETag (etag ));
226
+ }
227
+
222
228
@ Test
223
229
void ifMatch () {
224
230
String ifMatch = "\" v2.6\" " ;
You can’t perform that action at this time.
0 commit comments