Files
fiber/middleware/skip/skip.go
zeekayandHanzo Dev f60e254acb module: rename to github.com/zap-proto/fiber/v3
Fork of gofiber/fiber v3 based on the v3.2.0 tag. Rewrites all self-imports
github.com/gofiber/fiber/v3 -> github.com/zap-proto/fiber/v3. Upstream
gofiber/schema and gofiber/utils/v2 dependencies are left untouched.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-10 12:49:35 -07:00

23 lines
481 B
Go

package skip
import (
"github.com/zap-proto/fiber/v3"
)
// New returns a middleware that calls the provided predicate for each request.
// If the predicate evaluates to true the wrapped handler is skipped and the next
// handler in the chain is executed.
func New(handler fiber.Handler, exclude func(c fiber.Ctx) bool) fiber.Handler {
if exclude == nil {
return handler
}
return func(c fiber.Ctx) error {
if exclude(c) {
return c.Next()
}
return handler(c)
}
}