diff --git a/provider_client.go b/provider_client.go index 08fd0ca8..a47ea0cd 100644 --- a/provider_client.go +++ b/provider_client.go @@ -168,9 +168,6 @@ func (client *ProviderClient) Request(method, url string, options RequestOpts) ( } req.Header.Set("Accept", applicationJSON) - for k, v := range client.AuthenticatedHeaders() { - req.Header.Add(k, v) - } // Set the User-Agent header req.Header.Set("User-Agent", client.UserAgent.Join()) @@ -185,6 +182,11 @@ func (client *ProviderClient) Request(method, url string, options RequestOpts) ( } } + // get latest auth token + for k, v := range client.AuthenticatedHeaders() { + req.Header.Set(k, v) + } + // Set connection parameter to close the connection immediately when we've got the response req.Close = true