1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-24 08:22:21 +02:00

Moving some logic around

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-09-24 15:15:52 -07:00
parent 51a1ef432c
commit c0571e37c3

View File

@ -285,7 +285,7 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo
// Strip trailing slash // Strip trailing slash
if r.echo.stripTrailingSlash { if r.echo.stripTrailingSlash {
l := len(path)-1 l := len(path) - 1
if path != "/" && path[l] == '/' { // Issue #218 if path != "/" && path[l] == '/' { // Issue #218
path = path[:l] path = path[:l]
} }
@ -386,15 +386,12 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo
// Match-any node // Match-any node
MatchAny: MatchAny:
// c = cn.getChild() // c = cn.getChild()
c = cn.findChildWithType(mtype) if cn = cn.findChildWithType(mtype); cn == nil {
if c != nil { // Not found
cn = c return
ctx.pvalues[len(cn.pnames)-1] = search
goto Found
} }
ctx.pvalues[len(cn.pnames)-1] = search
// Not found goto Found
return
} }
Found: Found: