/// <summary>
        /// Adds an element with the provided key and value to the <see cref="IHeaderDictionary"/>.
        /// </summary>
        /// <param name="dic">The <see cref="IHeaderDictionary"/> to extend.</param>
        /// <param name="key">The string to use as the key of the element to add.</param>
        /// <param name="value">The string to use as the value of the element to add.</param>
        /// <param name="useAsciiEncodingConversion">if set to <c>true</c> an ASCII encoding conversion is applied to the <paramref name="value"/>.</param>
        public static void AddOrUpdateHeader(this IHeaderDictionary dic, string key, StringValues value, bool useAsciiEncodingConversion = true)
        {
            var headerValue = useAsciiEncodingConversion ? new StringValues(EncodingConverter.ToAsciiEncodedString(value)) : value;

            if (headerValue != StringValues.Empty)
            {
                dic.AddOrUpdate(key, headerValue.ToString().Where(c => !char.IsControl(c)).FromChars());
            }
        }