Skip to content

Commit

Permalink
change respponse to json
Browse files Browse the repository at this point in the history
  • Loading branch information
prongbang committed May 1, 2021
1 parent fb5b457 commit 703e630
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fibercasbinrest

import (
"log"
"net/http"
"strings"

"github.com/casbin/casbin/v2"
Expand Down Expand Up @@ -55,7 +56,8 @@ func middlewareWithConfig(config Config) fiber.Handler {
if config.Skipper(c) || config.CheckPermissions(c) {
return c.Next()
}
return fiber.ErrForbidden
return c.Status(http.StatusForbidden).
JSON(fiber.Map{"message": "Forbidden"})
}
}

Expand Down

0 comments on commit 703e630

Please sign in to comment.