diff --git a/src/NzbDrone.Host/Owin/MiddleWare/NzbDroneVersionMiddleWare.cs b/src/NzbDrone.Host/Owin/MiddleWare/NzbDroneVersionMiddleWare.cs index 33e563db7..2c18b4b6d 100644 --- a/src/NzbDrone.Host/Owin/MiddleWare/NzbDroneVersionMiddleWare.cs +++ b/src/NzbDrone.Host/Owin/MiddleWare/NzbDroneVersionMiddleWare.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Owin; using NzbDrone.Common.EnvironmentInfo; @@ -18,13 +19,17 @@ public void Attach(IAppBuilder appBuilder) public class AddApplicationVersionHeader : OwinMiddleware { + private readonly KeyValuePair _versionHeader; + public AddApplicationVersionHeader(OwinMiddleware next) : base(next) { + _versionHeader = new KeyValuePair("X-ApplicationVersion", + new[] { BuildInfo.Version.ToString() }); } public override Task Invoke(IOwinContext context) { - context.Response.Headers.Add("X-ApplicationVersion", new string[] { BuildInfo.Version.ToString() }); + context.Response.Headers.Add(_versionHeader); return Next.Invoke(context); } }