Skip to content

Commit ccec19a

Browse files
togettoyouthinkerou
authored andcommitted
turn on HandleMethodNotAllowed when using NoMethod #2871 (#2872)
1 parent b052104 commit ccec19a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,9 @@ func (engine *Engine) NoRoute(handlers ...HandlerFunc) {
264264
engine.rebuild404Handlers()
265265
}
266266

267-
// NoMethod sets the handlers called when... TODO.
267+
// NoMethod sets the handlers called when NoMethod.
268268
func (engine *Engine) NoMethod(handlers ...HandlerFunc) {
269+
engine.HandleMethodNotAllowed = true
269270
engine.noMethod = handlers
270271
engine.rebuild405Handlers()
271272
}

0 commit comments

Comments
 (0)