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:
parent
2773fda883
commit
118e07158e
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user