MCPcopy
hub / github.com/gofiber/fiber / Test_CookieJarSetRepeatedCookieKeys

Function Test_CookieJarSetRepeatedCookieKeys

client/cookiejar_test.go:138–166  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func Test_CookieJarSetRepeatedCookieKeys(t *testing.T) {
139 t.Parallel()
140 host := "fast.http"
141 cj := &CookieJar{}
142
143 uri := fasthttp.AcquireURI()
144 uri.SetHost(host)
145
146 cookie := &fasthttp.Cookie{}
147 cookie.SetKey("k")
148 cookie.SetValue("v")
149
150 cookie2 := &fasthttp.Cookie{}
151 cookie2.SetKey("k")
152 cookie2.SetValue("v2")
153
154 cookie3 := &fasthttp.Cookie{}
155 cookie3.SetKey("key")
156 cookie3.SetValue("value")
157
158 cj.Set(uri, cookie, cookie2, cookie3)
159
160 cookies := cj.Get(uri)
161 require.Len(t, cookies, 2)
162 require.Equal(t, "k", string(cookies[0].Key()))
163 require.Equal(t, "v2", string(cookies[0].Value()))
164 require.Equal(t, host, string(cookies[0].Domain()))
165 require.True(t, bytes.Equal(cookies[0].Value(), cookie2.Value()))
166}
167
168func Test_CookieJarSetKeyValue(t *testing.T) {
169 t.Parallel()

Callers

nothing calls this directly

Calls 5

SetMethod · 0.95
GetMethod · 0.95
LenMethod · 0.65
ValueMethod · 0.65
DomainMethod · 0.65

Tested by

no test coverage detected