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