File tree 3 files changed +20
-6
lines changed
main/java/org/springframework/mock/web
test/java/org/springframework/mock/web
spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet
3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -104,7 +104,12 @@ public String getSameSite() {
104
104
* @see <a href="https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1">The Partitioned attribute spec</a>
105
105
*/
106
106
public void setPartitioned (boolean partitioned ) {
107
- setAttribute ("Partitioned" , "" );
107
+ if (partitioned ) {
108
+ setAttribute ("Partitioned" , "" );
109
+ }
110
+ else {
111
+ setAttribute ("Partitioned" , null );
112
+ }
108
113
}
109
114
110
115
/**
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ void constructCookie() {
46
46
assertThat (cookie .getMaxAge ()).isEqualTo (-1 );
47
47
assertThat (cookie .getPath ()).isNull ();
48
48
assertThat (cookie .isHttpOnly ()).isFalse ();
49
+ assertThat (cookie .isPartitioned ()).isFalse ();
49
50
assertThat (cookie .getSecure ()).isFalse ();
50
51
assertThat (cookie .getSameSite ()).isNull ();
51
52
}
@@ -207,9 +208,11 @@ void setInvalidAttributeExpiresShouldThrow() {
207
208
@ Test
208
209
void setPartitioned () {
209
210
MockCookie cookie = new MockCookie ("SESSION" , "123" );
210
- cookie .setAttribute ( "Partitioned" , "" );
211
-
211
+ assertThat ( cookie .isPartitioned ()). isFalse ( );
212
+ cookie . setPartitioned ( true );
212
213
assertThat (cookie .isPartitioned ()).isTrue ();
214
+ cookie .setPartitioned (false );
215
+ assertThat (cookie .isPartitioned ()).isFalse ();
213
216
}
214
217
215
218
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -104,7 +104,12 @@ public String getSameSite() {
104
104
* @see <a href="https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1">The Partitioned attribute spec</a>
105
105
*/
106
106
public void setPartitioned (boolean partitioned ) {
107
- setAttribute ("Partitioned" , "" );
107
+ if (partitioned ) {
108
+ setAttribute ("Partitioned" , "" );
109
+ }
110
+ else {
111
+ setAttribute ("Partitioned" , null );
112
+ }
108
113
}
109
114
110
115
/**
@@ -197,6 +202,7 @@ public String toString() {
197
202
.append ("Comment" , getComment ())
198
203
.append ("Secure" , getSecure ())
199
204
.append ("HttpOnly" , isHttpOnly ())
205
+ .append ("Partitioned" , isPartitioned ())
200
206
.append (SAME_SITE , getSameSite ())
201
207
.append ("Max-Age" , getMaxAge ())
202
208
.append (EXPIRES , getAttribute (EXPIRES ))
You can’t perform that action at this time.
0 commit comments