File tree 2 files changed +8
-2
lines changed
main/java/org/springframework/http
test/java/org/springframework/http
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1073,8 +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 \" " );
1076
+ Assert .isTrue (etag .startsWith ("\" " ) || etag .startsWith ("W/\" " ),
1077
+ "Invalid ETag: does not start with W/\" or \" " );
1078
1078
Assert .isTrue (etag .endsWith ("\" " ), "Invalid ETag: does not end with \" " );
1079
1079
set (ETAG , etag );
1080
1080
}
Original file line number Diff line number Diff line change @@ -219,6 +219,12 @@ void illegalETag() {
219
219
assertThatIllegalArgumentException ().isThrownBy (() -> headers .setETag (eTag ));
220
220
}
221
221
222
+ @ Test
223
+ void illegalETagWithoutQuoteAfterWSlash () {
224
+ String etag = "W/v2.6\" " ;
225
+ assertThatIllegalArgumentException ().as ("Invalid Weak ETag" ).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