From 453891e620459ff38f7bc43b207004b240fc5fb8 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 Closes #5601 --- src/Sonarr.Http/Middleware/VersionMiddleware.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Sonarr.Http/Middleware/VersionMiddleware.cs b/src/Sonarr.Http/Middleware/VersionMiddleware.cs index 79a3f84d9..abb443944 100644 --- a/src/Sonarr.Http/Middleware/VersionMiddleware.cs +++ b/src/Sonarr.Http/Middleware/VersionMiddleware.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using NzbDrone.Common.EnvironmentInfo; +using Sonarr.Http.Extensions; namespace Sonarr.Http.Middleware { @@ -19,7 +20,7 @@ namespace Sonarr.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); }