Send
Sets the HTTP response body. The Send body can be of any type.
Send doesn’t append like the Write method.
- c.Send(body ...interface{})
- app.Get("/", func(c *fiber.Ctx) {
- c.Send("Hello, World!") // => "Hello, World!"
- c.Send([]byte("Hello, World!")) // => "Hello, World!"
- c.Send(123) // => 123
- })
Fiber also provides SendBytes
& SendString
methods for raw inputs.
- c.SendBytes(b []byte)
- c.SendString(s string)
- app.Get("/", func(c *fiber.Ctx) {
- c.SendByte([]byte("Hello, World!"))
- // => "Hello, World!"
- c.SendString("Hello, World!")
- // => "Hello, World!"
- })