Ejemplo n.º 1
0
 public void SetContentHeader(string name, string value)
 {
     ContentHeaders ??= new();
     if (ContentHeaders.ContainsKey(name))
     {
         ContentHeaders[name] = value;
     }
     else
     {
         ContentHeaders.Add(name, value);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a specific request header to the Request Header Collection
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public void AddContentHeader(string name, string value)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (string.IsNullOrWhiteSpace(value))
            {
                throw new ArgumentNullException($"the value of {name}");
            }

            ContentHeaders.Add(name, value);
        }