public static void Set(this HttpRequestHeaders headers, string name, params string[] values)
 {
     if (headers == null)
     {
         throw new ArgumentNullException(nameof(headers));
     }
     headers.Set(name, (IEnumerable <string>)values);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds or updates a request header with the specified name.
        /// </summary>
        /// <param name="headers">The header collection to add or update to.</param>
        /// <param name="name">The name of the header to add or update.</param>
        /// <param name="value">The single value to set.</param>
        public static void Set(this HttpRequestHeaders headers, string name, string value)
        {
            if (headers == null)
            {
                throw new ArgumentNullException(nameof(headers));
            }

            headers.Set(name, new[] { value });
        }
        public static void Set(this HttpRequestHeaders headers, string header)
        {
            var index = header.IndexOf(':');

            if (index == -1)
            {
                return;
            }

            var name  = header.Substring(0, index);
            var value = header.Substring(index + 2);

            headers.Set(name, value);
        }