diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs index df493b4c3..a0a471cb2 100644 --- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -112,12 +112,15 @@ namespace Emby.Server.Implementations.HttpServer /// private IHasHeaders GetHttpResult(IRequest requestContext, byte[] content, string contentType, bool addCachePrevention, IDictionary responseHeaders = null) { + string compressionType = null; + bool isHeadRequest = false; + + if (requestContext != null) { + compressionType = GetCompressionType(requestContext, content, contentType); + isHeadRequest = string.Equals(requestContext.Verb, "head", StringComparison.OrdinalIgnoreCase); + } + IHasHeaders result; - - var compressionType = requestContext == null ? null : GetCompressionType(requestContext, content, contentType); - - var isHeadRequest = string.Equals(requestContext.Verb, "head", StringComparison.OrdinalIgnoreCase); - if (string.IsNullOrEmpty(compressionType)) { var contentLength = content.Length; @@ -791,4 +794,4 @@ namespace Emby.Server.Implementations.HttpServer { byte[] Compress(byte[] content); } -} \ No newline at end of file +}