Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ go:
- 1.12.x
- 1.13.x
- tip
env:
- GO111MODULE=on
install:
- go get -v golang.org/x/lint/golint
script:
Expand Down
2 changes: 1 addition & 1 deletion echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const (

const (
// Version of Echo
Version = "4.1.11"
Version = "4.1.13"
website = "https://echo.labstack.com"
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
banner = `
Expand Down
1 change: 1 addition & 0 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ func (r *Router) Find(method, path string, c Context) {
// Consider param route one level up only
// if no slash is remaining in search string
if cn = nn.findChildByKind(pkind); cn != nil && strings.IndexByte(ns, '/') == -1 {
pvalues[len(cn.pnames)-1] = search
break
}
for {
Expand Down
36 changes: 36 additions & 0 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,42 @@ func TestRouterMixedParams(t *testing.T) {
testRouterAPI(t, api2)
}

// Issue #1466
func TestRouterParam1466(t *testing.T) {
e := New()
r := e.router

r.Add(http.MethodPost, "/users/signup", func(c Context) error {
return nil
})
r.Add(http.MethodPost, "/users/signup/bulk", func(c Context) error {
return nil
})
r.Add(http.MethodPost, "/users/survey", func(c Context) error {
return nil
})
r.Add(http.MethodGet, "/users/:username", func(c Context) error {
return nil
})
r.Add(http.MethodGet, "/interests/:name/users", func(c Context) error {
return nil
})
r.Add(http.MethodGet, "/skills/:name/users", func(c Context) error {
return nil
})

c := e.NewContext(nil, nil).(*context)

r.Find(http.MethodGet, "/users/ajitem", c)
assert.Equal(t, "ajitem", c.Param("username"))

r.Find(http.MethodGet, "/users/sharewithme", c)
assert.Equal(t, "sharewithme", c.Param("username"))

r.Find(http.MethodGet, "/users/signup", c)
assert.Equal(t, "", c.Param("username"))
}

func benchmarkRouterRoutes(b *testing.B, routes []*Route) {
e := New()
r := e.router
Expand Down