aboutsummaryrefslogtreecommitdiff
path: root/cookie_test.go
diff options
context:
space:
mode:
authorGravatar Gürkan Yeşilyurt <gurkanyesilyurt07@gmail.com> 2024-04-08 19:23:23 +0300
committerGravatar GitHub <noreply@github.com> 2024-04-08 18:23:23 +0200
commita77e9c6b7907610f423cb3ac1cf447a5b292c6fa (patch)
treeaed2cad166e397f11b83db4fc17880909c9c4608 /cookie_test.go
parentchore(deps): bump golang.org/x/net from 0.22.0 to 0.23.0 (#1748) (diff)
downloadfasthttp-a77e9c6b7907610f423cb3ac1cf447a5b292c6fa.tar.gz
fasthttp-a77e9c6b7907610f423cb3ac1cf447a5b292c6fa.tar.bz2
fasthttp-a77e9c6b7907610f423cb3ac1cf447a5b292c6fa.zip
add support for CHIPS (Cookies Having Independent Partitioned State) (#1752)
* add support for CHIPS (Cookies Having Independent Partitioned State) * fix comment lines * Update cookie.go fix lint error: should omit comparison to bool constant
Diffstat (limited to 'cookie_test.go')
-rw-r--r--cookie_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/cookie_test.go b/cookie_test.go
index b4b81ac..4a87f15 100644
--- a/cookie_test.go
+++ b/cookie_test.go
@@ -243,6 +243,35 @@ func TestCookieHttpOnly(t *testing.T) {
}
}
+func TestCookiePartitioned(t *testing.T) {
+ t.Parallel()
+
+ var c Cookie
+
+ if err := c.Parse("foo=bar; PATH=/; secure; Partitioned"); err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if !c.Partitioned() {
+ t.Fatalf("Partitioned must be set")
+ }
+ s := c.String()
+ if !strings.Contains(s, "; Partitioned") {
+ t.Fatalf("missing Partitioned flag in cookie %q", s)
+ }
+
+ if !c.Secure() {
+ t.Fatalf("secure must be set")
+ }
+ s = c.String()
+ if !strings.Contains(s, "; secure") {
+ t.Fatalf("missing secure flag in cookie %q", s)
+ }
+
+ if string(c.Path()) != "/" {
+ t.Fatalf("path must be set /")
+ }
+}
+
func TestCookieAcquireReleaseSequential(t *testing.T) {
t.Parallel()