1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-28 10:51:48 +00:00
Radarr/NzbDrone.Api/Frontend/IAddCacheHeaders.cs

32 lines
783 B
C#
Raw Normal View History

2013-07-15 18:25:16 +00:00
using System;
2013-07-14 04:19:36 +00:00
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;
}
2013-07-15 18:25:16 +00:00
if (request.Url.Path.EndsWith("app.js", StringComparison.CurrentCultureIgnoreCase))
2013-07-14 04:19:36 +00:00
{
response.Headers.DisableCache();
return;
}
response.Headers.EnableCache();
}
}
}