From 33c227045acc469295302b5aeb79c930cf5ecf33 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 23 Feb 2016 13:35:41 -0800 Subject: [PATCH] Revert "Fixed #217" This reverts commit c782b3fc755dd875907c832ca9402808091b726c. --- router.go | 4 ---- router_test.go | 42 ------------------------------------------ 2 files changed, 46 deletions(-) diff --git a/router.go b/router.go index b447a2ad..42a05663 100644 --- a/router.go +++ b/router.go @@ -379,10 +379,6 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo // c = cn.getChild() if cn = cn.findChildByKind(mkind); cn == nil { // Not found - if nn != nil { // Issue #217 - cn = nn - continue - } return } ctx.pvalues[len(cn.pnames)-1] = search diff --git a/router_test.go b/router_test.go index 7876e9cf..c3357223 100644 --- a/router_test.go +++ b/router_test.go @@ -503,48 +503,6 @@ func TestRouterPriority(t *testing.T) { } } -// Issue #217 -func TestRouterPriorityWithMatchAny(t *testing.T) { - e := New() - r := e.router - - // Routes - r.Add(GET, "/aa", func(c *Context) error { - c.Set("a", 1) - return nil - }, e) - r.Add(GET, "/ab", func(c *Context) error { - c.Set("b", 2) - return nil - }, e) - r.Add(GET, "/*", func(c *Context) error { - c.Set("c", 3) - return nil - }, e) - c := NewContext(nil, nil, e) - - // Route > /aa - h, _ := r.Find(GET, "/aa", c) - if assert.NotNil(t, h) { - h(c) - assert.Equal(t, 1, c.Get("a")) - } - - // Route > /ab - h, _ = r.Find(GET, "/ab", c) - if assert.NotNil(t, h) { - h(c) - assert.Equal(t, 2, c.Get("b")) - } - - // Route > /* - h, _ = r.Find(GET, "/abc", c) - if assert.NotNil(t, h) { - h(c) - assert.Equal(t, 3, c.Get("c")) - } -} - func TestRouterParamNames(t *testing.T) { e := New() r := e.router