Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 807528a

Browse files
committed
Find X-OAuth-Scopes header of any case
1 parent bc911f1 commit 807528a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/GitHub.Api/LoginManager.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,14 @@ async Task<LoginResult> GetUserAndCheckScopes(IGitHubClient client)
346346
var response = await client.Connection.Get<User>(
347347
UserEndpoint, null, null).ConfigureAwait(false);
348348

349-
if (response.HttpResponse.Headers.ContainsKey(ScopesHeader))
349+
var scopes = response.HttpResponse.Headers
350+
.Where(h => string.Equals(h.Key, ScopesHeader, StringComparison.OrdinalIgnoreCase))
351+
.Select(h => h.Value)
352+
.FirstOrDefault();
353+
354+
if (scopes != null)
350355
{
351-
var returnedScopes = new ScopesCollection(response.HttpResponse.Headers[ScopesHeader]
356+
var returnedScopes = new ScopesCollection(scopes
352357
.Split(',')
353358
.Select(x => x.Trim())
354359
.ToArray());

0 commit comments

Comments
 (0)