Status

Sets the HTTP status for the response.

Method is a chainable.

  1. func (c *Ctx) Status(status int) *Ctx
  1. app.Get("/fiber", func(c *fiber.Ctx) error {
  2. c.Status(200)
  3. return nil
  4. }
  5. app.Get("/hello", func(c *fiber.Ctx) error {
  6. return c.Status(400).SendString("Bad Request")
  7. }
  8. app.Get("/world", func(c *fiber.Ctx) error {
  9. return c.Status(404).SendFile("./public/gopher.png")
  10. })