missed one call to setTokenAuth

This commit is contained in:
shin- 2013-10-23 18:00:40 +02:00
parent 0fca0f12f6
commit 1ff180d1b4

View file

@ -153,7 +153,7 @@ func doWithCookies(c *http.Client, req *http.Request) (*http.Response, error) {
return res, err return res, err
} }
func setTokenAuth(req *http.Request, token []string) (*http.Request) { func setTokenAuth(req *http.Request, token []string) *http.Request {
if req.Header.Get("Authorization") == "" { // Don't override if req.Header.Get("Authorization") == "" { // Don't override
req.Header.Set("Authorization", "Token "+strings.Join(token, ",")) req.Header.Set("Authorization", "Token "+strings.Join(token, ","))
} }
@ -269,9 +269,7 @@ func (r *Registry) GetRemoteTags(registries []string, repository string, token [
if err != nil { if err != nil {
return nil, err return nil, err
} }
if req.Header.Get("Authorization") == "" { // Don't override req = setTokenAuth(req, token)
req.Header.Set("Authorization", "Token "+strings.Join(token, ","))
}
res, err := doWithCookies(r.client, req) res, err := doWithCookies(r.client, req)
if err != nil { if err != nil {
return nil, err return nil, err