qudoco-be/utils/index.utils.go

18 lines
345 B
Go
Raw Normal View History

2026-02-24 09:37:19 +00:00
package utils
import "github.com/gofiber/fiber/v2"
func IsEnabled(key bool) func(c *fiber.Ctx) bool {
if key {
return nil
}
return func(c *fiber.Ctx) bool { return true }
}
func CsrfErrorHandler(c *fiber.Ctx, err error) error {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"error": "CSRF protection: " + err.Error(),
})
}