From e48df7da5e3d3eb81f68e71c0fe27a64063f00ac Mon Sep 17 00:00:00 2001 From: crobibero Date: Mon, 31 Aug 2020 09:15:20 -0600 Subject: [PATCH] Only create product header once --- Jellyfin.Server/Startup.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jellyfin.Server/Startup.cs b/Jellyfin.Server/Startup.cs index a468f4dff0..f50e5716de 100644 --- a/Jellyfin.Server/Startup.cs +++ b/Jellyfin.Server/Startup.cs @@ -53,16 +53,17 @@ namespace Jellyfin.Server services.AddJellyfinApiAuthorization(); + var productHeader = new ProductInfoHeaderValue(_applicationHost.Name.Replace(' ', '-'), _applicationHost.ApplicationVersionString); services .AddHttpClient(NamedClient.Default, c => { - c.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(_applicationHost.Name.Replace(' ', '-'), _applicationHost.ApplicationVersionString)); + c.DefaultRequestHeaders.UserAgent.Add(productHeader); }) .ConfigurePrimaryHttpMessageHandler(x => new DefaultHttpClientHandler()); services.AddHttpClient(NamedClient.MusicBrainz, c => { - c.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(_applicationHost.Name.Replace(' ', '-'), _applicationHost.ApplicationVersionString)); + c.DefaultRequestHeaders.UserAgent.Add(productHeader); c.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue($"({_applicationHost.ApplicationUserAgentAddress})")); }) .ConfigurePrimaryHttpMessageHandler(x => new DefaultHttpClientHandler());