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

Fixed router

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-04-11 13:49:45 -07:00
parent 4a2bdcab27
commit 9f41bbedec

View File

@ -164,7 +164,7 @@ func (r *router) Find(method, path string, params Params) (h HandlerFunc, echo *
// Search order static > param > catch-all
for {
if search == "" || search == cn.prefix {
if search == "" || search == cn.prefix { // Fix me
// Found
h = cn.handler
echo = cn.echo
@ -173,11 +173,9 @@ func (r *router) Find(method, path string, params Params) (h HandlerFunc, echo *
pl := len(cn.prefix)
l := lcp(search, cn.prefix)
if l < pl {
// Not found
return
if l == pl {
search = search[l:]
}
search = search[l:]
// Static node
e := cn.findEdge(search[0])
@ -211,7 +209,10 @@ func (r *router) Find(method, path string, params Params) (h HandlerFunc, echo *
search = "" // End search
continue
}
if tn != nil {
}
println(tn.handler, tn.prefix)
return
}
}