mirror of
https://github.com/labstack/echo.git
synced 2025-04-23 12:18:53 +02:00
Refactored some code
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
55e3dba946
commit
a7d1a8e0d1
@ -277,7 +277,7 @@ func (n *node) findHandler(method string) Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *node) check405() HandlerFunc {
|
func (n *node) checkMethodNotAllowed() HandlerFunc {
|
||||||
for _, m := range methods {
|
for _, m := range methods {
|
||||||
if h := n.findHandler(m); h != nil {
|
if h := n.findHandler(m); h != nil {
|
||||||
return methodNotAllowedHandler
|
return methodNotAllowedHandler
|
||||||
@ -412,7 +412,7 @@ End:
|
|||||||
|
|
||||||
// NOTE: Slow zone...
|
// NOTE: Slow zone...
|
||||||
if ctx.handler == nil {
|
if ctx.handler == nil {
|
||||||
ctx.handler = cn.check405()
|
ctx.handler = cn.checkMethodNotAllowed()
|
||||||
|
|
||||||
// Dig further for any, might have an empty value for *, e.g.
|
// Dig further for any, might have an empty value for *, e.g.
|
||||||
// serving a directory. Issue #207.
|
// serving a directory. Issue #207.
|
||||||
@ -421,7 +421,7 @@ End:
|
|||||||
}
|
}
|
||||||
ctx.pvalues[len(cn.pnames)-1] = ""
|
ctx.pvalues[len(cn.pnames)-1] = ""
|
||||||
if ctx.handler = cn.findHandler(method); ctx.handler == nil {
|
if ctx.handler = cn.findHandler(method); ctx.handler == nil {
|
||||||
ctx.handler = cn.check405()
|
ctx.handler = cn.checkMethodNotAllowed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user