mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
New: Update SignalR, Nancy, Owin. Enable Websockets
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Owin;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
using Owin;
|
||||
|
||||
namespace Radarr.Host.Owin.MiddleWare
|
||||
@@ -19,17 +22,24 @@ namespace Radarr.Host.Owin.MiddleWare
|
||||
public class AddApplicationVersionHeader : OwinMiddleware
|
||||
{
|
||||
private readonly KeyValuePair<string, string[]> _versionHeader;
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(AddApplicationVersionHeader));
|
||||
|
||||
public AddApplicationVersionHeader(OwinMiddleware next)
|
||||
: base(next)
|
||||
{
|
||||
_versionHeader = new KeyValuePair<string, string[]>("X-ApplicationVersion",
|
||||
new[] { BuildInfo.Version.ToString() });
|
||||
_versionHeader = new KeyValuePair<string, string[]>("X-Application-Version", new[] { BuildInfo.Version.ToString() });
|
||||
}
|
||||
public override Task Invoke(IOwinContext context)
|
||||
public override async Task Invoke(IOwinContext context)
|
||||
{
|
||||
context.Response.Headers.Add(_versionHeader);
|
||||
return Next.Invoke(context);
|
||||
try
|
||||
{
|
||||
context.Response.Headers.Add(_versionHeader);
|
||||
await Next.Invoke(context);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Debug("Unable to set version header");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user