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

Handle not found in router.Find

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-04-11 11:10:19 -07:00
parent 5e4eec15ff
commit 4a2bdcab27

View File

@ -171,13 +171,17 @@ func (r *router) Find(method, path string, params Params) (h HandlerFunc, echo *
return return
} }
pl := len(cn.prefix)
l := lcp(search, cn.prefix) l := lcp(search, cn.prefix)
if l < pl {
// Not found
return
}
search = search[l:] search = search[l:]
// Static node // Static node
e := cn.findEdge(search[0]) e := cn.findEdge(search[0])
if e != nil { if e != nil {
// Go deeper
cn = e cn = e
continue continue
} }