New: Only add version header for API requests

(cherry picked from commit 453891e620459ff38f7bc43b207004b240fc5fb8)
pull/8473/head
Mark McDowall 1 year ago committed by Bogdan
parent 850fef5c43
commit 51901dbb37

@ -1,6 +1,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using Radarr.Http.Extensions;
namespace Radarr.Http.Middleware namespace Radarr.Http.Middleware
{ {
@ -19,7 +20,7 @@ namespace Radarr.Http.Middleware
public async Task InvokeAsync(HttpContext context) public async Task InvokeAsync(HttpContext context)
{ {
if (!context.Response.Headers.ContainsKey(VERSIONHEADER)) if (context.Request.IsApiRequest() && !context.Response.Headers.ContainsKey(VERSIONHEADER))
{ {
context.Response.Headers.Add(VERSIONHEADER, _version); context.Response.Headers.Add(VERSIONHEADER, _version);
} }

Loading…
Cancel
Save