fix(AP): add request header
Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
6e8d26381e
commit
47560fe88b
2 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in a new issue