private bool ShouldCompress(HttpRequestMessage request)
 {
     return(request.Content != null &&
            !(request.Content?.Headers?.ContentEncoding?.Contains(new Windows.Web.Http.Headers.HttpContentCodingHeaderValue("gzip")) ?? false) &&
            !(request.Content?.Headers?.ContentEncoding?.Contains(new Windows.Web.Http.Headers.HttpContentCodingHeaderValue("deflate")) ?? false) &&
            (_RequestCondition?.ShouldProcess(request) ?? true));
 }
        /// <summary>
        /// Applies the configured dynamic headers and passes the request on.
        /// </summary>
        /// <remarks>
        /// <para>Does not modify headers that already have a value.</para>
        /// <para>Does not create/apply headers where the function returning the value returns null.</para>
        /// </remarks>
        /// <param name="request">The <see cref="Windows.Web.Http.HttpRequestMessage"/> to process and pass on.</param>
        /// <returns>An asynchronous operation whose result is a <see cref="HttpResponseMessage"/> from the server.</returns>
        public IAsyncOperationWithProgress <HttpResponseMessage, HttpProgress> SendRequestAsync(HttpRequestMessage request)
        {
            return(AsyncInfo.Run <HttpResponseMessage, HttpProgress>(async(cancellationToken, progress) =>
            {
                if (_ApplyHeadersCondition?.ShouldProcess(request) ?? true)
                {
                    foreach (var kvp in _DynamicHeaders)
                    {
                        var value = kvp.Value();
                        if (value != null)
                        {
                            request.Headers.Add(kvp.Key, value);
                        }

                        cancellationToken.ThrowIfCancellationRequested();
                    }
                }

                return await _InnerFilter.SendRequestAsync(request).AsTask().ConfigureAwait(false);
            }));
        }