Example #1
0
        static RestRequest GetNewRequest(string path, WebMethod method = WebMethod.Get)
        {
            var request = new RestRequest();
            request.Path = path;
            request.Method = method;
            request.Encoding = Encoding.GetEncoding("GB2312"); // ("GBK");
            request.UserAgent = UserAgent;
            request.Proxy = string.Empty;

            if (_cookies != null)
            {
                for (int i = 0; i < _cookies.Keys.Count; i++)
                {
                    var key = _cookies.Keys[i];
                    var value = _cookies[key];

                    request.AddCookie(new Uri(Authority), key, value);
                }
            }

            return request;
        }