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:
parent
4a2bdcab27
commit
9f41bbedec
11
router.go
11
router.go
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user