diff --git a/echo.go b/echo.go index 8372e8ed9..e095a913e 100644 --- a/echo.go +++ b/echo.go @@ -382,7 +382,7 @@ func (e *Echo) Match(methods []string, path string, handler HandlerFunc, middlew // provided root directory. func (e *Echo) Static(prefix, root string) { e.GET(prefix+"*", func(c Context) error { - return c.File(path.Join(root, c.Param("_*"))) + return c.File(path.Join(root, c.Param("*"))) }) } diff --git a/middleware/static.go b/middleware/static.go index f06be334b..55af74a2b 100644 --- a/middleware/static.go +++ b/middleware/static.go @@ -70,7 +70,7 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc { fs := http.Dir(config.Root) p := c.Request().URL.Path if strings.Contains(c.Path(), "*") { // If serving from a group, e.g. `/static*`. - p = c.Param("_*") + p = c.Param("*") } file := path.Clean(p) f, err := fs.Open(file) diff --git a/router.go b/router.go index 7be4f4a9e..32c2a4bf4 100644 --- a/router.go +++ b/router.go @@ -81,7 +81,7 @@ func (r *Router) Add(method, path string, h HandlerFunc, e *Echo) { r.insert(method, path[:i], nil, pkind, ppath, pnames, e) } else if path[i] == '*' { r.insert(method, path[:i], nil, skind, "", nil, e) - pnames = append(pnames, "_*") + pnames = append(pnames, "*") r.insert(method, path[:i+1], h, akind, ppath, pnames, e) return } diff --git a/router_test.go b/router_test.go index 3ebd9679c..da41e9d89 100644 --- a/router_test.go +++ b/router_test.go @@ -350,10 +350,10 @@ func TestRouterMatchAny(t *testing.T) { assert.Equal(t, "", c.Param("_*")) r.Find(GET, "/download", c) - assert.Equal(t, "download", c.Param("_*")) + assert.Equal(t, "download", c.Param("*")) r.Find(GET, "/users/joe", c) - assert.Equal(t, "joe", c.Param("_*")) + assert.Equal(t, "joe", c.Param("*")) } func TestRouterMicroParam(t *testing.T) { @@ -483,7 +483,7 @@ func TestRouterPriority(t *testing.T) { r.Find(GET, "/users/joe/books", c) c.handler(c) assert.Equal(t, 7, c.Get("g")) - assert.Equal(t, "joe/books", c.Param("_*")) + assert.Equal(t, "joe/books", c.Param("*")) } // Issue #372