mirror of
https://github.com/labstack/echo.git
synced 2025-01-07 23:01:56 +02:00
parent
56e678ff4d
commit
dba674adf2
@ -356,6 +356,11 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo
|
||||
// Param node
|
||||
Param:
|
||||
if c = cn.findChildByKind(pkind); c != nil {
|
||||
// Issue #378
|
||||
if len(ctx.pvalues) == n {
|
||||
continue
|
||||
}
|
||||
|
||||
// Save next
|
||||
if cn.label == '/' {
|
||||
nk = akind
|
||||
@ -363,6 +368,7 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo
|
||||
ns = search
|
||||
}
|
||||
cn = c
|
||||
|
||||
i, l := 0, len(search)
|
||||
for ; i < l && search[i] != '/'; i++ {
|
||||
}
|
||||
|
@ -311,6 +311,25 @@ func TestRouterTwoParam(t *testing.T) {
|
||||
assert.Equal(t, "1", c.P(1))
|
||||
}
|
||||
|
||||
// Issue #378
|
||||
func TestRouterParamWithSlash(t *testing.T) {
|
||||
e := New()
|
||||
r := e.router
|
||||
|
||||
r.Add(GET, "/a/:b/c/d/:e", func(c *Context) error {
|
||||
return nil
|
||||
}, e)
|
||||
|
||||
r.Add(GET, "/a/:b/c/:d/:f", func(c *Context) error {
|
||||
return nil
|
||||
}, e)
|
||||
|
||||
c := NewContext(nil, nil, e)
|
||||
assert.NotPanics(t, func() {
|
||||
r.Find(GET, "/a/1/c/d/2/3", c)
|
||||
})
|
||||
}
|
||||
|
||||
func TestRouterMatchAny(t *testing.T) {
|
||||
e := New()
|
||||
r := e.router
|
||||
|
Loading…
Reference in New Issue
Block a user