public IRestResponse Execute(IRestRequest request)
        {
            AuthenticateIfNeeded(request);

            var http         = _httpFactory.Create();
            var httpResponse = http.GetResponse(request);

            return(ToRestReponse(httpResponse));
        }
Exemple #2
0
        public static Task <HttpWebResponse> GetResponse(Uri uri, string requestMethod)
        {
            var request = Factory.Create(uri);

            request.Method = "HEAD";
            return(Factory.GetValidResponse(request));
        }
Exemple #3
0
        private IRestResponse Execute(IRestRequest request, string httpMethod, Func <IHttp, string, HttpResponse> getResponse)
        {
            AuthenticateIfNeeded(this, request);
            IRestResponse restResponse = new RestResponse();

            try
            {
                IHttp http = HttpFactory.Create();
                ConfigureHttp(request, http);
                restResponse         = ConvertToRestResponse(request, getResponse(http, httpMethod));
                restResponse.Request = request;
                restResponse.Request.IncreaseNumAttempts();
            }
            catch (Exception ex)
            {
                restResponse.ResponseStatus = ResponseStatus.Error;
                restResponse.ErrorMessage   = ex.Message;
                restResponse.ErrorException = ex;
            }
            return(restResponse);
        }
Exemple #4
0
 public LinkService(IHttpFactory httpFactory, IThingMapper thingMapper)
 {
     m_thingMapper = thingMapper;
     m_client      = httpFactory.Create();
 }
Exemple #5
0
 public SubredditService(IHttpFactory httpFactory, IThingMapper thingMapper)
 {
     m_httpClient  = httpFactory.Create();
     m_thingMapper = thingMapper;
 }
Exemple #6
0
 public CommentsService(IHttpFactory httpFactory, IThingMapper thingMapper)
 {
     m_thingMapper = thingMapper;
     m_httpClient  = httpFactory.Create();
 }
Exemple #7
0
 public static HttpWebRequest CreateRequest(Uri uri)
 {
     return(httpFactory.Create(uri));
 }