diff --git a/pkg/cmd/auth/shared/oauth_scopes.go b/pkg/cmd/auth/shared/oauth_scopes.go index c99b5543d..20dbf9a83 100644 --- a/pkg/cmd/auth/shared/oauth_scopes.go +++ b/pkg/cmd/auth/shared/oauth_scopes.go @@ -40,7 +40,7 @@ func HasMinimumScopes(httpClient httpClient, hostname, authToken string) error { return err } - req.Header.Set("Autorization", "token "+authToken) + req.Header.Set("Authorization", "token "+authToken) res, err := httpClient.Do(req) if err != nil { diff --git a/pkg/cmd/auth/shared/oauth_scopes_test.go b/pkg/cmd/auth/shared/oauth_scopes_test.go index 3b9766a95..0f6bd9f32 100644 --- a/pkg/cmd/auth/shared/oauth_scopes_test.go +++ b/pkg/cmd/auth/shared/oauth_scopes_test.go @@ -52,7 +52,9 @@ func Test_HasMinimumScopes(t *testing.T) { fakehttp := &httpmock.Registry{} defer fakehttp.Verify(t) + var gotAuthorization string fakehttp.Register(httpmock.REST("GET", ""), func(req *http.Request) (*http.Response, error) { + gotAuthorization = req.Header.Get("authorization") return &http.Response{ Request: req, StatusCode: 200, @@ -70,6 +72,7 @@ func Test_HasMinimumScopes(t *testing.T) { } else { assert.NoError(t, err) } + assert.Equal(t, gotAuthorization, "token ATOKEN") }) }