1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-26 05:21:30 +00:00

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`.
This commit is contained in:
liulixiang1988 2014-08-11 22:19:59 +08:00
parent 2773fda883
commit 118e07158e

View File

@ -459,7 +459,7 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin
if find { if find {
if l.regexps == nil { if l.regexps == nil {
if len(l.wildcards) == 0 { if len(l.wildcards) == 0 {
return true, strings.Replace(url, "/"+url_placeholder, "", 1) return true, strings.Replace(url, "/"+url_placeholder, "", 1) + tourl(params)
} }
if len(l.wildcards) == 1 { if len(l.wildcards) == 1 {
if v, ok := params[l.wildcards[0]]; ok { if v, ok := params[l.wildcards[0]]; ok {