From 118e07158edbedc79730d155a47fe90dbffdd51c Mon Sep 17 00:00:00 2001 From: liulixiang1988 Date: Mon, 11 Aug 2014 22:19:59 +0800 Subject: [PATCH] improve the 'geturl' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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`. --- router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router.go b/router.go index d24241e6..03eb5e83 100644 --- a/router.go +++ b/router.go @@ -459,7 +459,7 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin if find { if l.regexps == nil { 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 v, ok := params[l.wildcards[0]]; ok {