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

Method Cookies

req.go:344–346  ·  view source on GitHub ↗

Cookies are used for getting a cookie value by key. Defaults to the empty string "" if the cookie doesn't exist. If a default value is given, it will return that value if the cookie doesn't exist. The returned value is only valid within the handler. Do not store any references. Make copies or use th

(key string, defaultValue ...string)

Source from the content-addressed store, hash-verified

342// The returned value is only valid within the handler. Do not store any references.
343// Make copies or use the Immutable setting to use the value outside the Handler.
344func (r *DefaultReq) Cookies(key string, defaultValue ...string) string {
345 return defaultString(r.c.app.toString(r.c.fasthttp.Request.Header.Cookie(key)), defaultValue)
346}
347
348// Request return the *fasthttp.Request object
349// This allows you to use all fasthttp request methods

Callers

nothing calls this directly

Calls 3

defaultStringFunction · 0.85
toStringMethod · 0.80
CookieMethod · 0.65

Tested by

no test coverage detected