From cc4f945d497285e7bdba2f3e50d300ed99fc237b Mon Sep 17 00:00:00 2001 From: "leitao.zhang" Date: Wed, 24 Feb 2021 18:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/handler/proxyhandler.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index 2fb5d4d..e690659 100644 --- a/src/handler/proxyhandler.go +++ b/src/handler/proxyhandler.go @@ -165,7 +165,22 @@ func Proxy(c *gin.Context) { reqURL.RawQuery = c.Request.URL.RawQuery } else { if c.Request.URL.RawQuery != "" { - reqURL.RawQuery += "&" + c.Request.URL.RawQuery + oldQ := c.Request.URL.Query() + newQ := c.Request.URL.Query() + for k, v := range newQ { + if len(v) > 1 { + for kk, vv := range v { + if kk == 0 { + oldQ.Set(k, vv) + } else { + oldQ.Add(k, vv) + } + } + } else { + oldQ.Set(k, v[0]) + } + } + reqURL.RawQuery = oldQ.Encode() } } -- 2.26.0