Fix release download
Only ever try to set an `Authorization` request header to hosts that we have OAuth credentials for; skip the header otherwise.
This commit is contained in:
parent
b34fe8123a
commit
662f83fcb9
1 changed files with 1 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ func NewHTTPClient(io *iostreams.IOStreams, cfg config.Config, appVersion string
|
|||
api.AddHeader("User-Agent", fmt.Sprintf("GitHub CLI %s", appVersion)),
|
||||
api.AddHeaderFunc("Authorization", func(req *http.Request) (string, error) {
|
||||
hostname := ghinstance.NormalizeHostname(req.URL.Hostname())
|
||||
if token, err := cfg.Get(hostname, "oauth_token"); err == nil || token != "" {
|
||||
if token, err := cfg.Get(hostname, "oauth_token"); err == nil && token != "" {
|
||||
return fmt.Sprintf("token %s", token), nil
|
||||
}
|
||||
return "", nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue