1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-22 20:06:21 +02:00

Revert "Fixed #217"

This reverts commit c782b3fc75.
This commit is contained in:
Vishal Rana 2016-02-23 13:35:41 -08:00
parent c782b3fc75
commit 33c227045a
2 changed files with 0 additions and 46 deletions

View File

@ -379,10 +379,6 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo
// c = cn.getChild() // c = cn.getChild()
if cn = cn.findChildByKind(mkind); cn == nil { if cn = cn.findChildByKind(mkind); cn == nil {
// Not found // Not found
if nn != nil { // Issue #217
cn = nn
continue
}
return return
} }
ctx.pvalues[len(cn.pnames)-1] = search ctx.pvalues[len(cn.pnames)-1] = search

View File

@ -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) { func TestRouterParamNames(t *testing.T) {
e := New() e := New()
r := e.router r := e.router