diff --git a/src/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs b/src/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs
index 28cecd695..183326415 100644
--- a/src/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs
+++ b/src/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs
@@ -1,11 +1,18 @@
using Nancy;
using Nancy.Bootstrapper;
-using NzbDrone.Common.EnvironmentInfo;
+using NzbDrone.Api.Frontend;
namespace NzbDrone.Api.Extensions.Pipelines
{
- public class NzbDroneVersionPipeline : IRegisterNancyPipeline
+ public class CacheHeaderPipeline : IRegisterNancyPipeline
{
+ private readonly ICacheableSpecification _cacheableSpecification;
+
+ public CacheHeaderPipeline(ICacheableSpecification cacheableSpecification)
+ {
+ _cacheableSpecification = cacheableSpecification;
+ }
+
public void Register(IPipelines pipelines)
{
pipelines.AfterRequest.AddItemToStartOfPipeline(Handle);
@@ -13,9 +20,13 @@ namespace NzbDrone.Api.Extensions.Pipelines
private void Handle(NancyContext context)
{
- if (!context.Response.Headers.ContainsKey("X-ApplicationVersion"))
+ if (_cacheableSpecification.IsCacheable(context))
+ {
+ context.Response.Headers.EnableCache();
+ }
+ else
{
- context.Response.Headers.Add("X-ApplicationVersion", BuildInfo.Version.ToString());
+ context.Response.Headers.DisableCache();
}
}
}
diff --git a/src/NzbDrone.Api/Extensions/Pipelines/NzbDroneVersionPipeline.cs b/src/NzbDrone.Api/Extensions/Pipelines/NzbDroneVersionPipeline.cs
index 183326415..28cecd695 100644
--- a/src/NzbDrone.Api/Extensions/Pipelines/NzbDroneVersionPipeline.cs
+++ b/src/NzbDrone.Api/Extensions/Pipelines/NzbDroneVersionPipeline.cs
@@ -1,18 +1,11 @@
using Nancy;
using Nancy.Bootstrapper;
-using NzbDrone.Api.Frontend;
+using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Extensions.Pipelines
{
- public class CacheHeaderPipeline : IRegisterNancyPipeline
+ public class NzbDroneVersionPipeline : IRegisterNancyPipeline
{
- private readonly ICacheableSpecification _cacheableSpecification;
-
- public CacheHeaderPipeline(ICacheableSpecification cacheableSpecification)
- {
- _cacheableSpecification = cacheableSpecification;
- }
-
public void Register(IPipelines pipelines)
{
pipelines.AfterRequest.AddItemToStartOfPipeline(Handle);
@@ -20,13 +13,9 @@ namespace NzbDrone.Api.Extensions.Pipelines
private void Handle(NancyContext context)
{
- if (_cacheableSpecification.IsCacheable(context))
- {
- context.Response.Headers.EnableCache();
- }
- else
+ if (!context.Response.Headers.ContainsKey("X-ApplicationVersion"))
{
- context.Response.Headers.DisableCache();
+ context.Response.Headers.Add("X-ApplicationVersion", BuildInfo.Version.ToString());
}
}
}
diff --git a/src/NzbDrone.Api/Frontend/IsCacheableSpecification.cs b/src/NzbDrone.Api/Frontend/CacheableSpecification.cs
similarity index 86%
rename from src/NzbDrone.Api/Frontend/IsCacheableSpecification.cs
rename to src/NzbDrone.Api/Frontend/CacheableSpecification.cs
index 875e5727d..52b177ce8 100644
--- a/src/NzbDrone.Api/Frontend/IsCacheableSpecification.cs
+++ b/src/NzbDrone.Api/Frontend/CacheableSpecification.cs
@@ -1,5 +1,6 @@
using System;
using Nancy;
+using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Frontend
@@ -20,7 +21,13 @@ namespace NzbDrone.Api.Frontend
if (context.Request.Query.v == BuildInfo.Version) return true;
- if (context.Request.Path.StartsWith("/api", StringComparison.CurrentCultureIgnoreCase)) return false;
+ if (context.Request.Path.StartsWith("/api", StringComparison.CurrentCultureIgnoreCase))
+ {
+ if (context.Request.Path.ContainsIgnoreCase("/MediaCover")) return true;
+
+ return false;
+ }
+
if (context.Request.Path.StartsWith("/signalr", StringComparison.CurrentCultureIgnoreCase)) return false;
if (context.Request.Path.EndsWith("main.js")) return false;
if (context.Request.Path.StartsWith("/feed", StringComparison.CurrentCultureIgnoreCase)) return false;
diff --git a/src/NzbDrone.Api/MediaCovers/MediaCoverModule.cs b/src/NzbDrone.Api/MediaCovers/MediaCoverModule.cs
index 7b0cc4ea9..fae294784 100644
--- a/src/NzbDrone.Api/MediaCovers/MediaCoverModule.cs
+++ b/src/NzbDrone.Api/MediaCovers/MediaCoverModule.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
+using System.IO;
using Nancy;
using Nancy.Responses;
using NzbDrone.Common;
diff --git a/src/NzbDrone.Api/NzbDrone.Api.csproj b/src/NzbDrone.Api/NzbDrone.Api.csproj
index d4d52cb96..2207dafe2 100644
--- a/src/NzbDrone.Api/NzbDrone.Api.csproj
+++ b/src/NzbDrone.Api/NzbDrone.Api.csproj
@@ -122,14 +122,14 @@
-
+
-
+