improve the 'geturl'
If we have a url mapping like this:
`beego.Router(“/test”, &controllers.WeightController{},
"get:GetDetails”)`
when u use `UrlFor(“WeightController.GetDetails”, “foo”, 1, “bar”, 2 `,
it should return `/test?foo=1&bar=2` rather than `/test`.
Showing
1 changed file
with
1 additions
and
1 deletions
| ... | @@ -459,7 +459,7 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin | ... | @@ -459,7 +459,7 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin |
| 459 | if find { | 459 | if find { |
| 460 | if l.regexps == nil { | 460 | if l.regexps == nil { |
| 461 | if len(l.wildcards) == 0 { | 461 | if len(l.wildcards) == 0 { |
| 462 | return true, strings.Replace(url, "/"+url_placeholder, "", 1) | 462 | return true, strings.Replace(url, "/"+url_placeholder, "", 1) + tourl(params) |
| 463 | } | 463 | } |
| 464 | if len(l.wildcards) == 1 { | 464 | if len(l.wildcards) == 1 { |
| 465 | if v, ok := params[l.wildcards[0]]; ok { | 465 | if v, ok := params[l.wildcards[0]]; ok { | ... | ... |
-
Please register or sign in to post a comment