Example #1
0
        public IHttpRequest CreateRequest(string operationName, JsonObject parameters)
        {
            if (string.IsNullOrEmpty(Uri))
            {
                throw new InvalidOperationException("You must set a Uri for the request.");
            }
            IHttpRequest webRequest = _requestFactory.Create(new Uri(Uri));

            webRequest.HttpVerb = operationName.ToHttpVerb();
            webRequest.AddHeaders(_headers);
            webRequest.AddCredentials(Credentials);
            webRequest.Accept = AcceptHeader;
            if (Proxy != null)
            {
                webRequest.Proxy = Proxy;
            }
            webRequest.AllowAutoRedirect = AllowAutoRedirect;
            webRequest.UserAgent         = UserAgent;
            webRequest.Timeout           = Timeout;

            if (_ifModifiedSince.HasValue)
            {
                ((HttpWebRequestWrapper)webRequest).IfModifiedSince = _ifModifiedSince.Value;
            }
            webRequest.AddRequestBody(ContentType, Body);

            return(webRequest);
        }