diff --git a/rpc.go b/rpc.go index c7de2c9..efd5e87 100644 --- a/rpc.go +++ b/rpc.go @@ -281,7 +281,7 @@ func (r *request) GetHttpClient(header map[string]string, timeout ApiTimeout) *h // // Date : 17:23 2022/6/30 func (r *request) getFullURLAndBody(serviceConfig *Service, apiConfig *Api, parameter map[string]interface{}) (string, []byte) { - fullURL := strings.ReplaceAll(serviceConfig.Domain+"/"+apiConfig.URI, "//", "/") + fullURL := strings.TrimRight(serviceConfig.Domain, "/") + "/" + strings.TrimLeft(apiConfig.URI, "/") for name, val := range parameter { fullURL = strings.ReplaceAll(fullURL, "{{"+name+"}}", fmt.Sprintf("%v", val)) } @@ -316,9 +316,9 @@ func (r *request) getFullURLAndBody(serviceConfig *Service, apiConfig *Api, para } query := strings.Join(parameterPair, "&") if len(query) == 0 { - return strings.ReplaceAll(fullURL, "//", "/"), body + return fullURL, body } - return strings.ReplaceAll(fullURL, "//", "/") + "?" + query, body + return fullURL + "?" + query, body } // validateResponseHttpCode 验证http状态码