示例#1
0
 public static T For <T>(HttpClient httpClient, IResponseDeserializer responseDeserializer = null, IRequestBodySerializer requestBodySerializer = null)
 {
     return(new RestClient(httpClient)
     {
         ResponseDeserializer = responseDeserializer, RequestBodySerializer = requestBodySerializer
     }.For <T>());
 }
 public Http(
     IHttpRequestSender requestSender,
     IResponseDeserializer responseDeserializer)
 {
     this.requestSender        = requestSender;
     this.responseDeserializer = responseDeserializer;
 }
示例#3
0
 public static T For <T>(string baseUrl, RequestModifier requestModifier, IResponseDeserializer responseDeserializer = null, IRequestBodySerializer requestBodySerializer = null)
 {
     return(new RestClient(baseUrl, requestModifier)
     {
         ResponseDeserializer = responseDeserializer, RequestBodySerializer = requestBodySerializer
     }.For <T>());
 }
示例#4
0
 public FunctionalTestCollection(TFactory factory)
 {
     _factory      = factory;
     _client       = _factory.CreateClient();
     _dbContext    = _factory.GetService <AppDbContext>();
     _deserializer = GetDeserializer();
     ClearDbContext();
 }
示例#5
0
        public RESTClient(IHttpConnector HttpConnector, IResponseDeserializer Deserializer)
        {
            if (HttpConnector == null)
            {
                throw new ArgumentNullException(nameof(HttpConnector));
            }
            if (Deserializer == null)
            {
                throw new ArgumentNullException(nameof(Deserializer));
            }

            this.httpConnector = HttpConnector;
            this.deserializer  = Deserializer;
        }
        internal UkrlpSoapApiClient(
            HttpClient httpClient,
            UkrlpApiConfiguration configuration,
            ILogger <UkrlpSoapApiClient> logger,
            IRequestSerializer requestSerializer,
            IResponseDeserializer responseDeserializer)
        {
            _httpClient             = httpClient;
            _httpClient.BaseAddress = new Uri(configuration.WebServiceUrl, UriKind.Absolute);

            _configuration        = configuration;
            _logger               = logger;
            _requestSerializer    = requestSerializer;
            _responseDeserializer = responseDeserializer;
        }
示例#7
0
        public RestClient(Uri baseUri, TimeSpan timeout,
                          Func <HttpMessageHandler> handlerFactory,
                          IContentEncoder contentEncoder,
                          IResponseDeserializer responseDeserializer)
        {
            ContentEncoder       = contentEncoder;
            ResponseDeserializer = responseDeserializer;
            Timeout = timeout;
            BaseUri = baseUri;

            _client = new HttpClient(handlerFactory())
            {
                Timeout     = Timeout,
                BaseAddress = BaseUri
            };

            _client.DefaultRequestHeaders.Accept.Clear();
        }
示例#8
0
 public ResponseDeserializerWrapper(IResponseDeserializer deserializer) =>
 this.deserializer = deserializer;
示例#9
0
 public EndToEndTest(TestFixture <TestStartup> fixture)
 {
     _fixture      = fixture;
     _deserializer = GetDeserializer();
 }
示例#10
0
 public HttpRestrictionSource(HttpClient client, HostPort host, IResponseDeserializer deserializer)
 {
     this.client       = client ?? throw new ArgumentNullException(nameof(client));
     this.host         = host;
     this.deserializer = deserializer ?? throw new ArgumentNullException(nameof(deserializer));
 }
示例#11
0
 /// <summary>
 /// Get response generic object from response, using own response deserializer.
 /// </summary>
 /// <typeparam name="T">Type of response object data.</typeparam>
 /// <returns>Response object</returns>
 public T GetResponse <T>(IResponseDeserializer <T> ownResponseDeserializer)
 => ownResponseDeserializer.Deserialize(GetResponseToString);
示例#12
0
 public HttpExecutor(IRequestSender requestSender, IResponseDeserializer responseDeserializer)
 {
     this.requestSender        = requestSender;
     this.responseDeserializer = responseDeserializer;
 }
示例#13
0
 public HttpClientRequest SetDeserializer(IResponseDeserializer specificDeserializer)
 {
     this.Deserializer = specificDeserializer;
     return(this);
 }
示例#14
0
 public RestClient(IResponseDeserializer deserializer, RestSharp.IRestClient restClient)
 {
     _deserializer = deserializer;
     _restClient   = restClient;
 }