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.
- c.Is(t string) bool
- // Content-Type: text/html; charset=utf-8
- app.Get("/", func(c *fiber.Ctx) {
- c.Is("html") // true
- c.Is(".html") // true
- c.Is("json") // false
- })