turn on HandleMethodNotAllowed when using NoMethod #2871

This commit is contained in:
togettoyou 2021-09-17 10:29:32 +08:00
parent 3a6f18f32f
commit 078ee34cfd

3
gin.go
View File

@ -264,8 +264,9 @@ func (engine *Engine) NoRoute(handlers ...HandlerFunc) {
engine.rebuild404Handlers()
}
// NoMethod sets the handlers called when... TODO.
// NoMethod sets the handlers called when NoMethod.
func (engine *Engine) NoMethod(handlers ...HandlerFunc) {
engine.HandleMethodNotAllowed = true
engine.noMethod = handlers
engine.rebuild405Handlers()
}