diff --git a/RestService.cs b/RestService.cs index 90f63ae..c83b9ea 100644 --- a/RestService.cs +++ b/RestService.cs @@ -3,7 +3,9 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Neighbourhood.omg.lol.Models; using System.Diagnostics; +using System.Net; using System.Net.Http.Json; +using System.Reflection; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; @@ -17,6 +19,8 @@ namespace Neighbourhood.omg.lol { public RestService(string? token = null) { _client = new HttpClient(); _client.BaseAddress = new Uri(BaseUrl); + AssemblyName name = Assembly.GetExecutingAssembly().GetName(); + _client.DefaultRequestHeaders.UserAgent.Add(new System.Net.Http.Headers.ProductInfoHeaderValue(name.Name ?? "Neighbourhood.omg.lol", name.Version?.ToString())); _serializerOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, WriteIndented = true