File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
main/java/org/springframework/http
test/java/org/springframework/http Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1048,8 +1048,8 @@ public long getDate() {
10481048 */
10491049 public void setETag (@ Nullable String etag ) {
10501050 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 \" " );
10531053 Assert .isTrue (etag .endsWith ("\" " ), "Invalid ETag: does not end with \" " );
10541054 set (ETAG , etag );
10551055 }
Original file line number Diff line number Diff line change @@ -196,6 +196,12 @@ void illegalETag() {
196196 assertThatIllegalArgumentException ().isThrownBy (() -> headers .setETag (eTag ));
197197 }
198198
199+ @ Test
200+ void illegalETagWithoutQuoteAfterWSlash () {
201+ String etag = "W/v2.6\" " ;
202+ assertThatIllegalArgumentException ().as ("Invalid Weak ETag" ).isThrownBy (() -> headers .setETag (etag ));
203+ }
204+
199205 @ Test
200206 void ifMatch () {
201207 String ifMatch = "\" v2.6\" " ;
You can’t perform that action at this time.
0 commit comments