1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Supply Accept-Language header in API requests

This commit is contained in:
Salman Ahmed 2023-06-08 02:50:29 +03:00
parent ab790ec96a
commit 9f842ccdc0

View File

@ -9,6 +9,7 @@ using JetBrains.Annotations;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Extensions;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API namespace osu.Game.Online.API
@ -116,10 +117,11 @@ namespace osu.Game.Online.API
WebRequest.Failed += Fail; WebRequest.Failed += Fail;
WebRequest.AllowRetryOnTimeout = false; WebRequest.AllowRetryOnTimeout = false;
WebRequest.AddHeader("x-api-version", API.APIVersion.ToString(CultureInfo.InvariantCulture)); WebRequest.AddHeader(@"Accept-Language", API.Language.ToCultureCode());
WebRequest.AddHeader(@"x-api-version", API.APIVersion.ToString(CultureInfo.InvariantCulture));
if (!string.IsNullOrEmpty(API.AccessToken)) if (!string.IsNullOrEmpty(API.AccessToken))
WebRequest.AddHeader("Authorization", $"Bearer {API.AccessToken}"); WebRequest.AddHeader(@"Authorization", $@"Bearer {API.AccessToken}");
if (isFailing) return; if (isFailing) return;