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. c.Cookies(key string, defaultValue ...string) string
  1. app.Get("/", func(c *fiber.Ctx) {
  2. // Get cookie by key:
  3. c.Cookies("name") // "john"
  4. c.Cookies("empty", "doe") // "doe"
  5. })

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