1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Refactored some code

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-03-30 14:47:04 -07:00
parent 55e3dba946
commit a7d1a8e0d1

View File

@ -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 {
if h := n.findHandler(m); h != nil {
return methodNotAllowedHandler
@ -412,7 +412,7 @@ End:
// NOTE: Slow zone...
if ctx.handler == nil {
ctx.handler = cn.check405()
ctx.handler = cn.checkMethodNotAllowed()
// Dig further for any, might have an empty value for *, e.g.
// serving a directory. Issue #207.
@ -421,7 +421,7 @@ End:
}
ctx.pvalues[len(cn.pnames)-1] = ""
if ctx.handler = cn.findHandler(method); ctx.handler == nil {
ctx.handler = cn.check405()
ctx.handler = cn.checkMethodNotAllowed()
}
}
return