mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Remove redirectHeaders method (#5120)
As of go 1.8, headers are copied on redirect, so we no longer need to do this manually. See https://github.com/golang/go/issues/4800 and https://go-review.googlesource.com/c/go/+/28930 for more context on go behaviour. Fixes #5042
This commit is contained in:
parent
32c6b62932
commit
34a1b58a75
@ -91,18 +91,6 @@ func New(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*Ad
|
||||
return clnt, nil
|
||||
}
|
||||
|
||||
// redirectHeaders copies all headers when following a redirect URL.
|
||||
// This won't be needed anymore from go 1.8 (https://github.com/golang/go/issues/4800)
|
||||
func redirectHeaders(req *http.Request, via []*http.Request) error {
|
||||
if len(via) == 0 {
|
||||
return nil
|
||||
}
|
||||
for key, val := range via[0].Header {
|
||||
req.Header[key] = val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func privateNew(endpoint, accessKeyID, secretAccessKey string, secure bool) (*AdminClient, error) {
|
||||
// construct endpoint.
|
||||
endpointURL, err := getEndpointURL(endpoint, secure)
|
||||
@ -120,8 +108,7 @@ func privateNew(endpoint, accessKeyID, secretAccessKey string, secure bool) (*Ad
|
||||
endpointURL: *endpointURL,
|
||||
// Instantiate http client and bucket location cache.
|
||||
httpClient: &http.Client{
|
||||
Transport: http.DefaultTransport,
|
||||
CheckRedirect: redirectHeaders,
|
||||
Transport: http.DefaultTransport,
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user