Type

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

  1. c.Type(t string) string
  1. app.Get("/", func(c *fiber.Ctx) {
  2. c.Type(".html") // => "text/html"
  3. c.Type("html") // => "text/html"
  4. c.Type("json") // => "application/json"
  5. c.Type("png") // => "image/png"
  6. })