Fix pasting Personal Access Token to auth login for GHE

This commit is contained in:
Mislav Marohnić 2021-02-23 10:19:11 +01:00
parent 04dcb327ca
commit f807795491
2 changed files with 4 additions and 1 deletions

View file

@ -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 {

View file

@ -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")
})
}