fix(AP): add request header

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2023-02-02 21:07:10 +01:00
parent 6e8d26381e
commit 47560fe88b
Signed by: sam
GPG Key ID: 4D8B07C18F31ACBD
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
@ -41,7 +42,7 @@ namespace BirdsiteLive.Domain
public async Task<Actor> GetUser(string objectId)
{
var httpClient = _httpClientFactory.CreateClient();
var httpClient = _httpClientFactory.CreateClient("BirdsiteLIVE");
httpClient.DefaultRequestHeaders.Add("Accept", "application/activity+json");
var result = await httpClient.GetAsync(objectId);

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using BirdsiteLive.Common.Settings;
using BirdsiteLive.Common.Structs;
@ -50,7 +51,9 @@ namespace BirdsiteLive
services.AddControllersWithViews();
services.AddHttpClient();
services.AddHttpClient("BirdsiteLIVE", httpClient => {
httpClient.DefaultRequestHeaders.Add("User-Agent", $"BirdsiteLIVE/${Program.VERSION}; +https://{Configuration["Instance:Domain"]}");
});
}
public void ConfigureContainer(ServiceRegistry services)