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

Function Test_CookieJar_HostOnlyCookieMatchesMixedCaseHost

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

Source from the content-addressed store, hash-verified

412}
413
414func Test_CookieJar_HostOnlyCookieMatchesMixedCaseHost(t *testing.T) {
415 t.Parallel()
416
417 jar := &CookieJar{}
418
419 origin := fasthttp.AcquireURI()
420 defer fasthttp.ReleaseURI(origin)
421 require.NoError(t, origin.Parse(nil, []byte("http://example.com/")))
422
423 c := &fasthttp.Cookie{}
424 c.SetKey("sid")
425 c.SetValue("123")
426 jar.Set(origin, c)
427
428 mixedCaseHost := fasthttp.AcquireURI()
429 defer fasthttp.ReleaseURI(mixedCaseHost)
430 require.NoError(t, mixedCaseHost.Parse(nil, []byte("http://Example.com/")))
431
432 require.Equal(t, []string{"sid"}, cookieKeys(jar.Get(mixedCaseHost)))
433}
434
435func Test_CookieJar_RejectUnrelatedResponseDomain(t *testing.T) {
436 t.Parallel()

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
GetMethod · 0.95
cookieKeysFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected