From 80a4b41e16412996a276039e02181d3772c10ffb Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Wed, 3 Jun 2015 16:19:03 -0700 Subject: [PATCH] Fixed build error Signed-off-by: Vishal Rana --- echo.go | 3 ++- router.go | 2 +- router_test.go | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/echo.go b/echo.go index 4fe46108..5ab12598 100644 --- a/echo.go +++ b/echo.go @@ -141,10 +141,11 @@ var ( // New creates an Echo instance. func New() (e *Echo) { - e = &Echo{maxParam: new(int), router: NewRouter(e)} + e = &Echo{maxParam: new(int)} e.pool.New = func() interface{} { return NewContext(nil, new(Response), e) } + e.router = NewRouter(e) //---------- // Defaults diff --git a/router.go b/router.go index 63fe2981..fcb21d37 100644 --- a/router.go +++ b/router.go @@ -302,7 +302,7 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo c = cn.findMchild() if c != nil { cn = c - ctx.pvalues[n] = search + ctx.pvalues[0] = search search = "" // End search continue } diff --git a/router_test.go b/router_test.go index 2c78b617..4370163d 100644 --- a/router_test.go +++ b/router_test.go @@ -469,6 +469,7 @@ func TestRouterPriority(t *testing.T) { if assert.NotNil(t, h) { h(c) assert.Equal(t, 7, c.Get("g")) + assert.Equal(t, "joe/books", c.Param("_name")) } }