Refactor replication, ILM handling in DELETE API (#10945)

This commit is contained in:
Poorna Krishnamoorthy
2020-11-25 11:24:50 -08:00
committed by GitHub
parent 0422eda6a2
commit 2ff655a745
13 changed files with 187 additions and 87 deletions

View File

@@ -118,20 +118,15 @@ func (t *BucketTarget) Clone() BucketTarget {
}
// URL returns target url
func (t BucketTarget) URL() string {
func (t BucketTarget) URL() *url.URL {
scheme := "http"
if t.Secure {
scheme = "https"
}
urlStr := fmt.Sprintf("%s://%s", scheme, t.Endpoint)
u, err := url.Parse(urlStr)
if err != nil {
return urlStr
return &url.URL{
Scheme: scheme,
Host: t.Endpoint,
}
if u.Port() == "80" || u.Port() == "443" {
u.Host = u.Hostname()
}
return u.String()
}
// Empty returns true if struct is empty.