Merge pull request #38 from 30x/go-1.8-fix
fix issue where go 1.8 would add duplicate Auth header
diff --git a/apigee_sync.go b/apigee_sync.go
index 80a00fa..ab47d17 100644
--- a/apigee_sync.go
+++ b/apigee_sync.go
@@ -86,12 +86,6 @@
}
}
-func Redirect(req *http.Request, _ []*http.Request) error {
- req.Header.Add("Authorization", "Bearer "+tokenManager.getBearerToken())
- req.Header.Add("org", apidInfo.ClusterID) // todo: this is strange.. is it needed?
- return nil
-}
-
func addHeaders(req *http.Request) {
req.Header.Set("Authorization", "Bearer "+tokenManager.getBearerToken())
req.Header.Set("apid_instance_id", apidInfo.InstanceID)
diff --git a/snapshot.go b/snapshot.go
index 438ddab..7a3c102 100644
--- a/snapshot.go
+++ b/snapshot.go
@@ -248,12 +248,15 @@
log.Infof("Snapshot Download: %s", uri)
client := &http.Client{
- CheckRedirect: Redirect,
+ CheckRedirect: func(req *http.Request, _ []*http.Request) error {
+ req.Header.Set("Authorization", "Bearer "+tokenManager.getBearerToken())
+ return nil
+ },
Timeout: httpTimeout,
}
//pollWithBackoff only accepts function that accept a single quit channel
- //to accomadate functions which need more parameters, wrap them in closures
+ //to accommodate functions which need more parameters, wrap them in closures
attemptDownload := getAttemptDownloadClosure(client, snapshot, uri)
pollWithBackoff(s.quitChan, attemptDownload, handleSnapshotServerError)
return nil