public static void CopyTo(this WebHeaderCollection source, WebHeaderCollection desination)
 {
     foreach (IHttpHeader header in source.GetHeaders())
     {
         desination[header.Name] = header.Value;
     }
 }
 public static void CopyTo(this WebHeaderCollection source, IHttpWebRequest desination)
 {
     foreach (IHttpHeader header in source.GetHeaders())
     {
         desination.SetHeader(header.Name, header.Value);
     }
 }
Esempio n. 3
0
        public static HttpWebRequest WithHeaders(this HttpWebRequest httpWebRequest, WebHeaderCollection headers)
        {
            foreach (IHttpHeader header in headers.GetHeaders())
            {
                httpWebRequest.SetHeader(header.Name, header.Value);
            }

            return(httpWebRequest);
        }
        public static void CopyTo(this WebHeaderCollection source, WebHeaderCollection destination)
        {
            if (source is null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (destination is null)
            {
                throw new ArgumentNullException(nameof(destination));
            }

            foreach (IHttpHeader header in source.GetHeaders())
            {
                destination[header.Name] = header.Value;
            }
        }