/// <summary>
        /// Initializes a new instance of the <see cref="ClientCompressionHandler" /> class.
        /// </summary>
        /// <param name="innerHandler">The inner handler.</param>
        /// <param name="contentSizeThreshold">The content size threshold before compressing.</param>
        /// <param name="compressors">The compressors.</param>
        public ClientCompressionHandler(HttpMessageHandler innerHandler, int contentSizeThreshold, params ICompressor[] compressors)
        {
            if (innerHandler != null)
            {
                this.InnerHandler = innerHandler;
            }

            this.Compressors = compressors;
            this.contentSizeThreshold = contentSizeThreshold;

            this.httpContentOperations = new HttpContentOperations();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerCompressionHandler" /> class.
        /// </summary>
        /// <param name="innerHandler">The inner handler.</param>
        /// <param name="contentSizeThreshold">The content size threshold before compressing.</param>
        /// <param name="enableCompression">Custom delegate to enable or disable compression.</param>
        /// <param name="compressors">The compressors.</param>
        protected BaseServerCompressionHandler(HttpMessageHandler innerHandler, int contentSizeThreshold, Predicate<HttpRequestMessage> enableCompression, params ICompressor[] compressors)
        {
            if (innerHandler != null)
            {
                this.InnerHandler = innerHandler;
            }

            this.Compressors = compressors;
            this.contentSizeThreshold = contentSizeThreshold;
            this.httpContentOperations = new HttpContentOperations();

            this.enableCompression = enableCompression ?? (x =>
            {
                // If request does not accept gzip or deflate, return false
                if (x.Headers.AcceptEncoding.All(y => y.Value != "gzip" && y.Value != "deflate"))
                {
                    return false;
                }

                // If compression has been explicitly disabled, return false
                if (x.Properties.ContainsKey("compression:Enable"))
                {
                    bool enable;
                    bool.TryParse(x.Properties["compression:Enable"].ToString(), out enable);

                    return enable;
                }

                return true;
            });
        }