Esempio n. 1
0
        public void SetRequestInformation(IWebInfo webInfo)
        {
            this.webRequest.ContentLength = webInfo.ContentLength;
            this.webRequest.ContentType   = webInfo.ContentType;

            this.webRequest.Method = webInfo.Method.ToString();

            this.webRequest.Accept    = CopyHeader(HeaderKeys.ACCEPT, webInfo, this.webRequest.Accept);
            this.webRequest.UserAgent = CopyHeader(HeaderKeys.USER_AGENT, webInfo, this.webRequest.UserAgent);

            this.webRequest.Timeout          = webInfo.Timeout;
            this.webRequest.ReadWriteTimeout = webInfo.Timeout;
        }
Esempio n. 2
0
 public string CopyHeader(string key, IWebInfo webInfo, string defaultValue)
 => webInfo.Headers.AllKeys.Any(m => m.Equals(key, StringComparison.InvariantCultureIgnoreCase)) ?
 webInfo.Headers[key] : defaultValue;