Is

Returns the matching content type, if the incoming request’s Content-Type HTTP header field matches the MIME type specified by the type parameter.

If the request has no body, it returns false.
  1. func (c *Ctx) Is(extension string) bool
  1. // Content-Type: text/html; charset=utf-8
  2. app.Get("/", func(c *fiber.Ctx) error {
  3. c.Is("html") // true
  4. c.Is(".html") // true
  5. c.Is("json") // false
  6. // ...
  7. })