forked from Mirrors/oauth2
AWS_DEFAULT_REGION should have been checked as a backup to AWS_REGION, but wasn't. Also removed a redundant print statement in a test case.
Change-Id: I0de4bcd5a134f7a9af249e5ebe56dfc3d35abf6d
This commit is contained in:
parent
9bb904979d
commit
57bbf4f324
|
@ -341,6 +341,8 @@ func (cs awsCredentialSource) subjectToken() (string, error) {
|
||||||
func (cs *awsCredentialSource) getRegion() (string, error) {
|
func (cs *awsCredentialSource) getRegion() (string, error) {
|
||||||
if envAwsRegion := getenv("AWS_REGION"); envAwsRegion != "" {
|
if envAwsRegion := getenv("AWS_REGION"); envAwsRegion != "" {
|
||||||
return envAwsRegion, nil
|
return envAwsRegion, nil
|
||||||
|
} else if envAwsRegion := getenv("AWS_DEFAULT_REGION"); envAwsRegion != "" {
|
||||||
|
return envAwsRegion, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if cs.RegionURL == "" {
|
if cs.RegionURL == "" {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package externalaccount
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -20,7 +19,6 @@ func TestRetrieveURLSubjectToken_Text(t *testing.T) {
|
||||||
if r.Method != "GET" {
|
if r.Method != "GET" {
|
||||||
t.Errorf("Unexpected request method, %v is found", r.Method)
|
t.Errorf("Unexpected request method, %v is found", r.Method)
|
||||||
}
|
}
|
||||||
fmt.Println(r.Header)
|
|
||||||
if r.Header.Get("Metadata") != "True" {
|
if r.Header.Get("Metadata") != "True" {
|
||||||
t.Errorf("Metadata header not properly included.")
|
t.Errorf("Metadata header not properly included.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue