Set a user agent for HttpCommunication

This commit is contained in:
CasualPokePlayer 2024-08-31 18:53:01 -07:00
parent 5b5652d01e
commit e22082c6b4
1 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,8 @@ using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using BizHawk.Common;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public sealed class HttpCommunication public sealed class HttpCommunication
@ -23,6 +25,7 @@ namespace BizHawk.Client.Common
_takeScreenshotCallback = takeScreenshotCallback; _takeScreenshotCallback = takeScreenshotCallback;
GetUrl = getURL; GetUrl = getURL;
PostUrl = postURL; PostUrl = postURL;
_client.DefaultRequestHeaders.UserAgent.ParseAdd($"BizHawk/{VersionInfo.GetEmuVersion()}");
} }
public string ExecGet(string url = null) => Get(url ?? GetUrl).Result; public string ExecGet(string url = null) => Get(url ?? GetUrl).Result;