From 58b935b4ead6cecf021ae6847f8e843055e5836b Mon Sep 17 00:00:00 2001 From: Patrick Jones Date: Mon, 19 Oct 2020 13:43:51 -0700 Subject: [PATCH] temp --- google/internal/oauth/stsExchange.go | 14 -------------- google/internal/oauth/stsExchange_test.go | 11 +---------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/google/internal/oauth/stsExchange.go b/google/internal/oauth/stsExchange.go index 24684e0..6255dc9 100644 --- a/google/internal/oauth/stsExchange.go +++ b/google/internal/oauth/stsExchange.go @@ -22,20 +22,6 @@ func ExchangeToken(endpoint string, request *STSTokenExchangeRequest, authentica data.Set("subject_token", request.SubjectToken) data.Set("scope", strings.Join(request.Scope, " ")) - //req, err := http.NewRequest("POST", endpoint, strings.NewReader(data.Encode())) - //if err != nil { - // fmt.Errorf("oauth2/google: failed to properly build http request") - //} - //for key, _ := range headers { - // for _, val := range headers.Values(key) { - // req.Header.Add(key, val) - // } - //} - //if authentication.ClientID != "" && authentication.ClientSecret != "" { - // plainHeader := authentication.ClientID + ":" + authentication.ClientSecret - // req.Header.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(plainHeader))) - //} - //req.Header.Add("Content-Length", strconv.Itoa(len(data.Encode()))) authentication.InjectAuthentication(&data, &headers) req, err := http.NewRequest("POST", endpoint, strings.NewReader(data.Encode())) if err != nil { diff --git a/google/internal/oauth/stsExchange_test.go b/google/internal/oauth/stsExchange_test.go index 31b1b3f..99f8959 100644 --- a/google/internal/oauth/stsExchange_test.go +++ b/google/internal/oauth/stsExchange_test.go @@ -1,15 +1,5 @@ package externalaccount -import ( - "net/http" - "net/http/httptest" - "testing" -) - -stsExchange_test.go - -package externalaccount - import ( "github.com/google/go-cmp/cmp" "golang.org/x/oauth2" @@ -97,6 +87,7 @@ func TestExchangeToken(t *testing.T) { if diff := cmp.Diff(*r, serverReq); diff != "" { t.Errorf("mismatched messages received by mock server (-want +got): \n%s", diff) } + if r.URL.String() != return }))