Skip to content
Snippets Groups Projects
Commit 01bbba55 authored by xg.gao's avatar xg.gao
Browse files

improve code

parent 4ea624b5
No related branches found
No related tags found
No related merge requests found
......@@ -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),
)
}
......
......@@ -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
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment