Merge pull request #1444 from smoogipoo/webrequest-updates

Apply osu!-side WebRequest changes
This commit is contained in:
Dean Herbert 2017-10-30 22:48:19 +09:00 committed by GitHub
commit 757d8be95f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 11 deletions

@ -1 +1 @@
Subproject commit 5986f2126832451a5a7ec832a483e1dcec1b38b8
Subproject commit ef10edfc750b39258edbff46019f1d10700548c2

View File

@ -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();
}
}

View File

@ -36,7 +36,7 @@ namespace osu.Game.Online.API
return request;
}
private void request_Progress(WebRequest request, long current, long total) => API.Scheduler.Add(delegate { Progress?.Invoke(current, total); });
private void request_Progress(long current, long total) => API.Scheduler.Add(delegate { Progress?.Invoke(current, total); });
protected APIDownloadRequest()
{
@ -99,8 +99,8 @@ namespace osu.Game.Online.API
throw new TimeoutException(@"API request timeout hit");
WebRequest = CreateWebRequest();
WebRequest.RetryCount = 0;
WebRequest.Headers[@"Authorization"] = $@"Bearer {api.AccessToken}";
WebRequest.AllowRetryOnTimeout = false;
WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}");
if (checkAndProcessFailure())
return;

View File

@ -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();
}
}