mirror of
https://github.com/labstack/echo.git
synced 2025-04-21 12:17:04 +02:00
parent
68e00e964c
commit
f251eead67
@ -394,7 +394,7 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo
|
|||||||
c = cn.findChildWithType(mtype)
|
c = cn.findChildWithType(mtype)
|
||||||
if c != nil {
|
if c != nil {
|
||||||
cn = c
|
cn = c
|
||||||
ctx.pvalues[0] = search
|
ctx.pvalues[len(ctx.pvalues) - 1] = search
|
||||||
search = "" // End search
|
search = "" // End search
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -352,6 +352,23 @@ func TestRouterMicroParam(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRouterMixParamMatchAny(t *testing.T) {
|
||||||
|
e := New()
|
||||||
|
r := e.router
|
||||||
|
|
||||||
|
// Route
|
||||||
|
r.Add(GET, "/users/:id/*", func(c *Context) error {
|
||||||
|
return nil
|
||||||
|
}, e)
|
||||||
|
c := NewContext(nil, nil, e)
|
||||||
|
|
||||||
|
h, _ := r.Find(GET, "/users/joe/comments", c)
|
||||||
|
if assert.NotNil(t, h) {
|
||||||
|
h(c)
|
||||||
|
assert.Equal(t, "joe", c.P(0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRouterMultiRoute(t *testing.T) {
|
func TestRouterMultiRoute(t *testing.T) {
|
||||||
e := New()
|
e := New()
|
||||||
r := e.router
|
r := e.router
|
||||||
|
Loading…
x
Reference in New Issue
Block a user