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

Var args for Context#SetParamNames and Context#SetParamValues.

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-04-17 09:41:20 -07:00
parent ce80fc8ea4
commit 1e04986e53
2 changed files with 6 additions and 6 deletions

View File

@ -53,13 +53,13 @@ type (
ParamNames() []string ParamNames() []string
// SetParamNames sets path parameter names. // SetParamNames sets path parameter names.
SetParamNames([]string) SetParamNames(...string)
// ParamValues returns path parameter values. // ParamValues returns path parameter values.
ParamValues() []string ParamValues() []string
// SetParamValues sets path parameter values. // SetParamValues sets path parameter values.
SetParamValues([]string) SetParamValues(...string)
// QueryParam returns the query param for the provided name. It is an alias // QueryParam returns the query param for the provided name. It is an alias
// for `engine.URL#QueryParam()`. // for `engine.URL#QueryParam()`.
@ -241,7 +241,7 @@ func (c *context) ParamNames() []string {
return c.pnames return c.pnames
} }
func (c *context) SetParamNames(names []string) { func (c *context) SetParamNames(names ...string) {
c.pnames = names c.pnames = names
} }
@ -249,7 +249,7 @@ func (c *context) ParamValues() []string {
return c.pvalues return c.pvalues
} }
func (c *context) SetParamValues(values []string) { func (c *context) SetParamValues(values ...string) {
c.pvalues = values c.pvalues = values
} }

View File

@ -400,7 +400,7 @@ func (r *Router) Find(method, path string, context Context) {
End: End:
context.SetHandler(cn.findHandler(method)) context.SetHandler(cn.findHandler(method))
context.SetPath(cn.ppath) context.SetPath(cn.ppath)
context.SetParamNames(cn.pnames) context.SetParamNames(cn.pnames...)
// NOTE: Slow zone... // NOTE: Slow zone...
if context.Handler() == nil { if context.Handler() == nil {
@ -417,7 +417,7 @@ End:
context.SetHandler(cn.checkMethodNotAllowed()) context.SetHandler(cn.checkMethodNotAllowed())
} }
context.SetPath(cn.ppath) context.SetPath(cn.ppath)
context.SetParamNames(cn.pnames) context.SetParamNames(cn.pnames...)
pvalues[len(cn.pnames)-1] = "" pvalues[len(cn.pnames)-1] = ""
} }