diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2025-08-14 18:07:12 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2025-08-14 18:07:12 +0100 |
| commit | 4697556cac819c47d068819b9fc9c3b4ea84e279 (patch) | |
| tree | b832d8fc6b643a8b9d0eeca35c1268e1649da731 /api/handlers/util.go | |
| parent | dd49c9205bb04844b686b9c3396c40eb49d25826 (diff) | |
Merge confplanner-web and replace fiber with native net/http
Diffstat (limited to 'api/handlers/util.go')
| -rw-r--r-- | api/handlers/util.go | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/api/handlers/util.go b/api/handlers/util.go deleted file mode 100644 index b0cf344..0000000 --- a/api/handlers/util.go +++ /dev/null @@ -1,28 +0,0 @@ -package handlers - -import ( - "fmt" - - "github.com/go-playground/validator/v10" - "github.com/gofiber/fiber/v2" -) - -var validate = validator.New(validator.WithRequiredStructEnabled()) - -func readBody(c *fiber.Ctx, request interface{}) error { - if err := c.BodyParser(request); err != nil { - return &fiber.Error{ - Code: fiber.StatusBadRequest, - Message: fmt.Errorf("Invalid request (%w)", err).Error(), - } - } - - if err := validate.Struct(request); err != nil { - return &fiber.Error{ - Code: fiber.StatusBadRequest, - Message: err.Error(), - } - } - - return nil -} |
