diff --git a/router.go b/router.go index 86a986a2..597660d3 100644 --- a/router.go +++ b/router.go @@ -524,7 +524,6 @@ func optionsMethodHandler(allowMethods string) func(c Context) error { // - Return it `Echo#ReleaseContext()`. func (r *Router) Find(method, path string, c Context) { ctx := c.(*context) - ctx.path = path currentNode := r.tree // Current node as root var ( diff --git a/router_test.go b/router_test.go index 825170a3..619cce09 100644 --- a/router_test.go +++ b/router_test.go @@ -674,6 +674,18 @@ func TestRouterStatic(t *testing.T) { assert.Equal(t, path, c.Get("path")) } +func TestRouterNoRoutablePath(t *testing.T) { + e := New() + r := e.router + c := e.NewContext(nil, nil).(*context) + + r.Find(http.MethodGet, "/notfound", c) + c.handler(c) + + // No routable path, don't set Path. + assert.Equal(t, "", c.Path()) +} + func TestRouterParam(t *testing.T) { e := New() r := e.router