SendStatus

Sets the status code and the correct status message in the body, if the response body is empty.

You can find all used status codes and messages here.

  1. func (c *Ctx) SendStatus(status int) error
  1. app.Get("/not-found", func(c *fiber.Ctx) error {
  2. return c.SendStatus(415)
  3. // => 415 "Unsupported Media Type"
  4. c.SendString("Hello, World!")
  5. return c.SendStatus(415)
  6. // => 415 "Hello, World!"
  7. })