1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00
Radarr/NzbDrone.Api/Frontend/IAddCacheHeaders.cs
2013-07-15 11:25:16 -07:00

32 lines
783 B
C#

using System;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Frontend
{
public interface IAddCacheHeaders
{
void ToResponse(Request request, Response response);
}
public class AddCacheHeaders : IAddCacheHeaders
{
public void ToResponse(Request request, Response response)
{
if (!RuntimeInfo.IsProduction)
{
response.Headers.DisableCache();
return;
}
if (request.Url.Path.EndsWith("app.js", StringComparison.CurrentCultureIgnoreCase))
{
response.Headers.DisableCache();
return;
}
response.Headers.EnableCache();
}
}
}