Type

Sets the Content-Type HTTP header to the MIME type listed here specified by the file extension.

  1. func (c *Ctx) Type(ext string, charset ...string) *Ctx
  1. app.Get("/", func(c *fiber.Ctx) error {
  2. c.Type(".html") // => "text/html"
  3. c.Type("html") // => "text/html"
  4. c.Type("png") // => "image/png"
  5. c.Type("json", "utf-8") // => "application/json; charset=utf-8"
  6. // ...
  7. })