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 @@ -1048,8 +1048,8 @@ public long getDate() {
1048
1048
*/
1049
1049
public void setETag (@ Nullable String etag ) {
1050
1050
if (etag != null ) {
1051
- Assert .isTrue (etag .startsWith ("\" " ) || etag .startsWith ("W/" ),
1052
- "Invalid ETag: does not start with W/ or \" " );
1051
+ Assert .isTrue (etag .startsWith ("\" " ) || etag .startsWith ("W/\" " ),
1052
+ "Invalid ETag: does not start with W/\" or \" " );
1053
1053
Assert .isTrue (etag .endsWith ("\" " ), "Invalid ETag: does not end with \" " );
1054
1054
set (ETAG , etag );
1055
1055
}
Original file line number Diff line number Diff line change @@ -196,6 +196,12 @@ void illegalETag() {
196
196
assertThatIllegalArgumentException ().isThrownBy (() -> headers .setETag (eTag ));
197
197
}
198
198
199
+ @ Test
200
+ void illegalETagWithoutQuoteAfterWSlash () {
201
+ String etag = "W/v2.6\" " ;
202
+ assertThatIllegalArgumentException ().as ("Invalid Weak ETag" ).isThrownBy (() -> headers .setETag (etag ));
203
+ }
204
+
199
205
@ Test
200
206
void ifMatch () {
201
207
String ifMatch = "\" v2.6\" " ;
You can’t perform that action at this time.
0 commit comments