From dc5b7dc102be1111dd57c4aa258ad00b0538c067 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 25 Feb 2017 21:41:03 +0000 Subject: [PATCH] rest: don't duplicate headers on redirect now go1.8 does it --- rest/rest.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rest/rest.go b/rest/rest.go index d3105b6b3..cdf115309 100644 --- a/rest/rest.go +++ b/rest/rest.go @@ -95,6 +95,8 @@ func DecodeJSON(resp *http.Response, result interface{}) (err error) { // ClientWithHeaderReset makes a new http client which resets the // headers passed in on redirect +// +// FIXME This is now unecessary with go1.8 func ClientWithHeaderReset(c *http.Client, headers map[string]string) *http.Client { if len(headers) == 0 { return c @@ -107,7 +109,7 @@ func ClientWithHeaderReset(c *http.Client, headers map[string]string) *http.Clie // Reset the headers in the new request for k, v := range headers { if v != "" { - req.Header.Add(k, v) + req.Header.Set(k, v) } } return nil