Cookies

Get cookie value by key, you could pass an optional default value that will be returned if the cookie key does not exist.

Signatures

  1. func (c *Ctx) Cookies(key string, defaultValue ...string) string
  1. app.Get("/", func(c *fiber.Ctx) error {
  2. // Get cookie by key:
  3. c.Cookies("name") // "john"
  4. c.Cookies("empty", "doe") // "doe"
  5. // ...
  6. })

Returned value is only valid within the handler. Do not store any references.
Make copies or use the
Immutable setting instead. Read more…