From 078ee34cfdc3991454b8a2409e0ea0a1a7b8c565 Mon Sep 17 00:00:00 2001 From: togettoyou Date: Fri, 17 Sep 2021 10:29:32 +0800 Subject: [PATCH] turn on HandleMethodNotAllowed when using NoMethod #2871 --- gin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gin.go b/gin.go index 6ab2be66..ae6d4799 100644 --- a/gin.go +++ b/gin.go @@ -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() }