1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

param alias, context#param

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-11-17 18:42:00 -08:00
parent b358b06311
commit fd9508ca39
2 changed files with 3 additions and 3 deletions

View File

@ -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]
}

View File

@ -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
}
}
}