From f47f68e336aaf52968892acd436c4cd37360142c Mon Sep 17 00:00:00 2001 From: gaoshiyao Date: Thu, 24 Oct 2019 20:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B7=AF=E7=94=B1=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 7 +++++-- src/handler/proxyhandler.go | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 1aff1af..b92ed98 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,10 @@ # 发布 -## go vendor - +```bash +go mod init +go mod vendor +go mod tidy +``` # 单条服务 PROXY_HOST=apaas.wodcloud.com diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index 04f0285..896dd43 100644 --- a/src/handler/proxyhandler.go +++ b/src/handler/proxyhandler.go @@ -42,9 +42,9 @@ func getProxyURL(req *http.Request) string { result = fmt.Sprintf("http://%s%s", config.ProxyHost, path) } else { result = fmt.Sprintf("http://%s%s?%s", config.ProxyHost, path, rawQuery) - } - if strings.HasSuffix(result, "/") { - result = strings.TrimRight(result, "/") + if strings.HasSuffix(result, "/") { + result = strings.TrimRight(result, "/") + } } return result } -- 2.26.0