diff --git a/consumers/consumerHTTP_PRPXY.go b/consumers/consumerHTTP_PRPXY.go index fd477a2..911e742 100644 --- a/consumers/consumerHTTP_PRPXY.go +++ b/consumers/consumerHTTP_PRPXY.go @@ -89,8 +89,8 @@ func (the *consumerHttpProxy) onData(w http.ResponseWriter, r *http.Request) { "id": id, } //沿用请求路由 - the.outHttpPost.Url += r.URL.String() - resp, err := the.outHttpPost.HttpPostWithParams(string(body), params) + newUrl := the.outHttpPost.Url + r.URL.String() + resp, err := the.outHttpPost.HttpPostWithParams(newUrl, string(body), params) if err != nil { return } diff --git a/dbHelper/httpHelper.go b/dbHelper/httpHelper.go index b5b7b3a..1d11648 100644 --- a/dbHelper/httpHelper.go +++ b/dbHelper/httpHelper.go @@ -93,7 +93,7 @@ func (the *HttpHelper) PublishWithHeader(messageBytes []byte, headers map[string } return resp, err } -func (the *HttpHelper) HttpPostWithParams(queryBody string, params map[string]string) (string, error) { +func (the *HttpHelper) HttpPostWithParams(urlStr, queryBody string, params map[string]string) (string, error) { tr := &http.Transport{ DisableKeepAlives: true, TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, @@ -103,7 +103,7 @@ func (the *HttpHelper) HttpPostWithParams(queryBody string, params map[string]st for k, v := range params { UrlParams.Set(k, v) } - targetUrl, _ := url.ParseRequestURI(the.Url) + targetUrl, _ := url.ParseRequestURI(urlStr) targetUrl.RawQuery = UrlParams.Encode() req, err := http.NewRequest("POST", targetUrl.String(), strings.NewReader(queryBody))