Skip to content

Commit

Permalink
Var args for Context#SetParamNames and Context#SetParamValues.
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Apr 17, 2016
1 parent ce80fc8 commit 1e04986
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ type (
ParamNames() []string

// SetParamNames sets path parameter names.
SetParamNames([]string)
SetParamNames(...string)

// ParamValues returns path parameter values.
ParamValues() []string

// SetParamValues sets path parameter values.
SetParamValues([]string)
SetParamValues(...string)

// QueryParam returns the query param for the provided name. It is an alias
// for `engine.URL#QueryParam()`.
Expand Down Expand Up @@ -241,15 +241,15 @@ func (c *context) ParamNames() []string {
return c.pnames
}

func (c *context) SetParamNames(names []string) {
func (c *context) SetParamNames(names ...string) {
c.pnames = names
}

func (c *context) ParamValues() []string {
return c.pvalues
}

func (c *context) SetParamValues(values []string) {
func (c *context) SetParamValues(values ...string) {
c.pvalues = values
}

Expand Down
4 changes: 2 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func (r *Router) Find(method, path string, context Context) {
End:
context.SetHandler(cn.findHandler(method))
context.SetPath(cn.ppath)
context.SetParamNames(cn.pnames)
context.SetParamNames(cn.pnames...)

// NOTE: Slow zone...
if context.Handler() == nil {
Expand All @@ -417,7 +417,7 @@ End:
context.SetHandler(cn.checkMethodNotAllowed())
}
context.SetPath(cn.ppath)
context.SetParamNames(cn.pnames)
context.SetParamNames(cn.pnames...)
pvalues[len(cn.pnames)-1] = ""
}

Expand Down

0 comments on commit 1e04986

Please sign in to comment.