From 51901dbb37d0ec8e14360878fba1280aba9db39e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 6 May 2023 22:34:22 -0700 Subject: [PATCH] New: Only add version header for API requests (cherry picked from commit 453891e620459ff38f7bc43b207004b240fc5fb8) --- src/Radarr.Http/Middleware/VersionMiddleware.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Radarr.Http/Middleware/VersionMiddleware.cs b/src/Radarr.Http/Middleware/VersionMiddleware.cs index 07985aa41..c3019ac3f 100644 --- a/src/Radarr.Http/Middleware/VersionMiddleware.cs +++ b/src/Radarr.Http/Middleware/VersionMiddleware.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using NzbDrone.Common.EnvironmentInfo; +using Radarr.Http.Extensions; namespace Radarr.Http.Middleware { @@ -19,7 +20,7 @@ namespace Radarr.Http.Middleware 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); }