Add user agent so non-api requests work again
This commit is contained in:
parent
c7400ca42f
commit
434c84ce5c
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue