1
mirror of https://github.com/rclone/rclone synced 2024-11-14 13:36:24 +01:00

rest: don't duplicate headers on redirect now go1.8 does it

This commit is contained in:
Nick Craig-Wood 2017-02-25 21:41:03 +00:00
parent 55eafb3a9a
commit dc5b7dc102

View File

@ -95,6 +95,8 @@ func DecodeJSON(resp *http.Response, result interface{}) (err error) {
// ClientWithHeaderReset makes a new http client which resets the // ClientWithHeaderReset makes a new http client which resets the
// headers passed in on redirect // headers passed in on redirect
//
// FIXME This is now unecessary with go1.8
func ClientWithHeaderReset(c *http.Client, headers map[string]string) *http.Client { func ClientWithHeaderReset(c *http.Client, headers map[string]string) *http.Client {
if len(headers) == 0 { if len(headers) == 0 {
return c return c
@ -107,7 +109,7 @@ func ClientWithHeaderReset(c *http.Client, headers map[string]string) *http.Clie
// Reset the headers in the new request // Reset the headers in the new request
for k, v := range headers { for k, v := range headers {
if v != "" { if v != "" {
req.Header.Add(k, v) req.Header.Set(k, v)
} }
} }
return nil return nil