Skip to content

Commit

Permalink
param alias, context#param
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Nov 18, 2016
1 parent b358b06 commit fd9508c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (c *context) SetPath(p string) {

func (c *context) Param(name string) string {
for i, n := range c.pnames {
if i < len(c.pnames) {
if i < len(c.pvalues) {
if n == name {
return c.pvalues[i]
}
Expand Down
4 changes: 2 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ func (r *Router) insert(method, path string, h HandlerFunc, t kind, ppath string
}
for i, n := range pnames {
// Param name aliases
if !strings.Contains(n, pnames[i]) {
cn.pnames[i] += "," + pnames[i]
if i < len(cn.pnames) && !strings.Contains(cn.pnames[i], n) {
cn.pnames[i] += "," + n
}
}
}
Expand Down

0 comments on commit fd9508c

Please sign in to comment.