From cd5324f1d1d766985b6825be48293ac10ceb1361 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 30 Oct 2017 21:23:47 +0900 Subject: [PATCH] Update API code to use the new Add* methods on requests --- osu.Desktop.Deploy/Program.cs | 2 +- osu.Game/Online/API/APIRequest.cs | 2 +- osu.Game/Online/API/OAuth.cs | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index d52be70b6e..54fb50d0f8 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -390,7 +390,7 @@ namespace osu.Desktop.Deploy public static void AuthenticatedBlockingPerform(this WebRequest r) { - r.Headers.Add("Authorization", $"token {GitHubAccessToken}"); + r.AddHeader("Authorization", $"token {GitHubAccessToken}"); r.Perform(); } } diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 74dddfc1c5..71b18103b0 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -100,7 +100,7 @@ namespace osu.Game.Online.API WebRequest = CreateWebRequest(); WebRequest.AllowRetryOnTimeout = false; - WebRequest.Headers[@"Authorization"] = $@"Bearer {api.AccessToken}"; + WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}"); if (checkAndProcessFailure()) return; diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 445688f2ce..2e00fe6f1b 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -127,7 +127,8 @@ namespace osu.Game.Online.API protected override void PrePerform() { - Parameters[@"refresh_token"] = RefreshToken; + AddParameter("refresh_token", RefreshToken); + base.PrePerform(); } } @@ -146,8 +147,9 @@ namespace osu.Game.Online.API protected override void PrePerform() { - Parameters[@"username"] = Username; - Parameters[@"password"] = Password; + AddParameter("username", Username); + AddParameter("password", Password); + base.PrePerform(); } } @@ -161,9 +163,10 @@ namespace osu.Game.Online.API protected override void PrePerform() { - Parameters[@"grant_type"] = GrantType; - Parameters[@"client_id"] = ClientId; - Parameters[@"client_secret"] = ClientSecret; + AddParameter("grant_type", GrantType); + AddParameter("client_id", ClientId); + AddParameter("client_secret", ClientSecret); + base.PrePerform(); } }