You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
662 B
23 lines
662 B
using System;
|
|
using Nancy;
|
|
using Nancy.Bootstrapper;
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
namespace NzbDrone.Api.Extensions.Pipelines
|
|
{
|
|
public class NzbDroneVersionPipeline : IRegisterNancyPipeline
|
|
{
|
|
public void Register(IPipelines pipelines)
|
|
{
|
|
pipelines.AfterRequest.AddItemToStartOfPipeline((Action<NancyContext>) Handle);
|
|
}
|
|
|
|
private void Handle(NancyContext context)
|
|
{
|
|
if (!context.Response.Headers.ContainsKey("X-ApplicationVersion"))
|
|
{
|
|
context.Response.Headers.Add("X-ApplicationVersion", BuildInfo.Version.ToString());
|
|
}
|
|
}
|
|
}
|
|
} |