mirror of
https://github.com/Radarr/Radarr
synced 2024-12-27 18:30:45 +00:00
Don't cache in debug
This commit is contained in:
parent
eb2cf64c17
commit
a163e511ae
1 changed files with 9 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
||||||
using Nancy.Responses;
|
using Nancy.Responses;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Frontend
|
namespace NzbDrone.Api.Frontend
|
||||||
{
|
{
|
||||||
|
@ -20,7 +21,9 @@ public class StaticResourceProvider : IProcessStaticResource
|
||||||
private readonly IEnumerable<IMapHttpRequestsToDisk> _requestMappers;
|
private readonly IEnumerable<IMapHttpRequestsToDisk> _requestMappers;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public StaticResourceProvider(IDiskProvider diskProvider, IEnumerable<IMapHttpRequestsToDisk> requestMappers, Logger logger)
|
public StaticResourceProvider(IDiskProvider diskProvider,
|
||||||
|
IEnumerable<IMapHttpRequestsToDisk> requestMappers,
|
||||||
|
Logger logger)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_requestMappers = requestMappers;
|
_requestMappers = requestMappers;
|
||||||
|
@ -45,7 +48,11 @@ public Response ProcessStaticResourceRequest(NancyContext context, string workin
|
||||||
if (_diskProvider.FileExists(filePath))
|
if (_diskProvider.FileExists(filePath))
|
||||||
{
|
{
|
||||||
var response = new StreamResponse(() => File.OpenRead(filePath), MimeTypes.GetMimeType(filePath));
|
var response = new StreamResponse(() => File.OpenRead(filePath), MimeTypes.GetMimeType(filePath));
|
||||||
|
|
||||||
|
if (RuntimeInfo.IsProduction)
|
||||||
|
{
|
||||||
response.Headers.EnableCache();
|
response.Headers.EnableCache();
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue