Skip to content

Commit

Permalink
Router: only create a new map for Fixed params if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
robfig committed May 27, 2013
1 parent ead9bcf commit eb8ef65
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion router.go
Expand Up @@ -434,8 +434,10 @@ var RouterFilter = func(c *Controller, fc []Filter) {
}

// Add the fixed parameters mapped by name.
c.Params.Fixed = make(url.Values)
for i, value := range route.FixedParams {
if c.Params.Fixed == nil {
c.Params.Fixed = make(url.Values)
}
if i < len(c.MethodType.Args) {
arg := c.MethodType.Args[i]
c.Params.Fixed.Set(arg.Name, value)
Expand Down

0 comments on commit eb8ef65

Please sign in to comment.