mirror of https://github.com/gofiber/fiber.git
Return 404 if Next does not match
parent
705b05216a
commit
f9c08818ed
|
@ -87,6 +87,8 @@ func (app *App) next(ctx *Ctx) bool {
|
|||
// Stop scanning the stack
|
||||
return true
|
||||
}
|
||||
ctx.SendStatus(404)
|
||||
ctx.SendString("Cannot " + ctx.method + " " + ctx.pathOriginal)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -179,10 +179,10 @@ func registerDummyRoutes(app *App) {
|
|||
// go test -v ./... -run=^$ -bench=Benchmark_Router_NotFound -benchmem -count=4
|
||||
func Benchmark_Router_NotFound(b *testing.B) {
|
||||
app := New()
|
||||
registerDummyRoutes(app)
|
||||
app.Use(func(c *Ctx) {
|
||||
|
||||
c.Next()
|
||||
})
|
||||
registerDummyRoutes(app)
|
||||
c := &fasthttp.RequestCtx{}
|
||||
|
||||
c.Request.Header.SetMethod("DELETE")
|
||||
|
|
Loading…
Reference in New Issue