diff --git a/common/url.go b/common/url.go index 5c3ba91a2216aaa8b2de1c0f14777818808ad58a..dfc231efcd0e8b5e46f625fdf12a5095a871afc2 100644 --- a/common/url.go +++ b/common/url.go @@ -419,8 +419,6 @@ func (c URL) GetParam(s string, d string) string { // GetParams ... func (c URL) GetParams() url.Values { - c.paramsLock.RLock() - defer c.paramsLock.RUnlock() return c.params } @@ -609,7 +607,8 @@ func (c *URL) Clone() *URL { return newUrl } -func (c *URL) CloneWithParams(reserveParams []string, methods []string) *URL { +// Copy url based on the reserved parameters' keys. +func (c *URL) CloneWithParams(reserveParams []string) *URL { params := url.Values{} for _, reserveParam := range reserveParams { v := c.GetParam(reserveParam, "") @@ -625,7 +624,7 @@ func (c *URL) CloneWithParams(reserveParams []string, methods []string) *URL { WithIp(c.Ip), WithPort(c.Port), WithPath(c.Path), - WithMethods(methods), + WithMethods(c.Methods), WithParams(params), ) } diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index 3aefc7bdfddcbaeb47fcba6f0b2d05594949bef1..f9e9cd6b9e0c7b84d456fab0ecc9f398e29e54c3 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -95,7 +95,7 @@ func getRegistry(regUrl *common.URL) registry.Registry { func getUrlToRegistry(providerUrl *common.URL, registryUrl *common.URL) *common.URL { if registryUrl.GetParamBool("simplified", false) { - return providerUrl.CloneWithParams(reserveParams, providerUrl.Methods) + return providerUrl.CloneWithParams(reserveParams) } return providerUrl }