Adding upstream version 2.52.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
a960158181
commit
6d002e9543
441 changed files with 95392 additions and 0 deletions
21
middleware/skip/skip.go
Normal file
21
middleware/skip/skip.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package skip
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
// New creates a middleware handler which skips the wrapped handler
|
||||
// if the exclude predicate returns true.
|
||||
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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue