public HttpClientRequest(Uri uri) { RequestUri = uri; Provider = DependencyInjector.Get <IHttpClientProvider> (); Handler = Provider.Create(); Client = Handler.CreateHttpClient(); }
/* * It's good practice to keep these requests asynchronous. .NET uses * async/await just like ES2017. */ public async Task <string> GetData(string baseUrl) { //The 'using' will help to prevent memory leaks //Create a new instance of HttpClient IHttpClientHandler client = _httpClient; //Setting up the response... using (HttpResponseMessage res = await client.GetAsync(baseUrl)) try { Console.WriteLine("Starting here before expection"); using (HttpContent content = res.Content) { string data = await content.ReadAsStringAsync(); if (data != null) { Console.WriteLine(data); return(data); } else { Console.WriteLine("no data"); return("err no data"); } } } catch (Exception e) { return("err no content"); } }
public AuthorService(IUnitOfWork <AlejandriaContext> uoW, IOptions <AlejandriaOptions> alejandriaOptions, IOptions <CircuitBreakerOptions> circuitBreakerOptions, IHttpClientHandler httpClientHandler) : base(uoW) { _authorRepository = uoW.Repository <IAuthorRepository>(); _bookRepository = uoW.Repository <IBookRepository>(); InitializeAlejandriaOptions(alejandriaOptions); InitializeCircuitBreaker(httpClientHandler, circuitBreakerOptions); }
public HttpClientRequest( InstrumentationOperation operation, HttpClientHandler handler, Uri requestUri) { Operation = operation; Parent = handler; RequestUri = requestUri; Provider = DependencyInjector.Get <IHttpClientProvider> (); Handler = Provider.Create(); Client = Handler.CreateHttpClient(); }
public HttpClientRequest( InstrumentationOperation operation, HttpClientHandler handler, HttpClientRequest primaryRequest, Uri requestUri) { Operation = operation; Parent = handler; RequestUri = requestUri; Handler = primaryRequest.Handler; Client = primaryRequest.Client; }
public PopulatorRunner( IRepository repository, IRedisStoreFactory redisStoreFactory, IHttpClientHandler httpClient, IConfiguration configuration, ILogger <PopulatorRunner> logger) { _repository = repository; _redisStoreFactory = redisStoreFactory; _httpClient = httpClient; _logger = logger; _databaseBatchSize = configuration.GetValue <int?>("DatabaseBatchSize") ?? 1000; _collectorBatchSize = configuration.GetValue <int?>("CollectorBatchSize") ?? 100; _maxErrorTimeInSeconds = configuration.GetValue <int?>("MaxErrorTimeInSeconds") ?? 60; _validStatusCodes = configuration.GetSection("ValidStatusCodes").Get <int[]>(); _validStatusCodesToDelete = configuration.GetSection("ValidStatusCodesToDelete").Get <int[]>(); _headersToStore = configuration.GetSection("HeadersToStore").Get <string[]>(); _apiBaseAddress = configuration["ApiBaseAddress"]; }
public OpenWeatherService(IHttpClientHandler httpClient) { _httpClient = httpClient; }
public BlockExplorerProvider(IHttpClientHandler httpClient) : base(httpClient) { }
public Requests(IHttpClientHandler httpClient) { _httpClient = httpClient; }
public ExtensionTestRunner(IHttpClientHandler extension) { this.extension = extension; }
public SmaxHcmHandler(IHttpClientHandler httpClientHandler, IOptions <SmaxHcmOptions> smaxHcmOptions) { HttpClientHandler = httpClientHandler; SmaxHcmOptions = smaxHcmOptions?.Value ?? throw new ArgumentException("No SmaxHcm options provided"); }
public void SetHandler(IHttpClientHandler handler) { this.Handler = handler; }
public GoogleController(ILogger logger, IHttpClientHandler httpHandler, IConfiguration config) { _logger = logger; _httpHandler = httpHandler; _config = config; }
public ExtensionTestRunner (IHttpClientHandler extension) { this.extension = extension; }
public MeterService(IHttpClientHandler httpClientHandler) { this.httpClientHandler = httpClientHandler; }
/// <summary> /// Initializes a new instance of the <see cref="StarshipDataService" /> class. /// </summary> /// <param name="httpClientHandler">The HTTP client handler.</param> /// <param name="appConfigurationManager">The application configuration manager.</param> public StarshipDataService(IHttpClientHandler httpClientHandler, IAppConfigurationManager appConfigurationManager) { _appConfigurationManager = appConfigurationManager; _httpClientHandler = httpClientHandler; }
public Notifier(ILogger logger, IHttpClientHandler httpClient, string slackConnectionString) { _logger = logger; _httpClient = httpClient; _uri = new Uri(slackConnectionString); }
public YandexCustomSeacher(string subscriptionKey, string userName, IHttpClientHandler client) { SubscriptionKey = subscriptionKey; UserName = userName; _client = client; }
public CyberArkHandler(IHttpClientHandler httpClientHandler, IOptions <CyberArkOptions> cyberArkOptions) { HttpClientHandler = httpClientHandler; CyberArkOptions = cyberArkOptions?.Value ?? throw new ArgumentException("No CyberArk options provided"); }
public BaseHttpProvider(IHttpClientHandler httpClient) { _httpClient = httpClient; }
private void InitializeCircuitBreaker(IHttpClientHandler httpClientHandler, IOptions <CircuitBreakerOptions> circuitBreakerOptions) { _httpClientHandler = httpClientHandler; _circuitBreakerOptions = circuitBreakerOptions.Value; }
public SendFeedSyncHandler(IHttpClientHandler httpClientHandler) { _httpClientHandler = httpClientHandler; }
public KrakenAdapter(IHttpClientHandler httpClientHandler) { _httpClientHandler = httpClientHandler; }
/// <summary> /// Converts provided <see cref="IHttpClientHandler"/> info to <see cref="HttpClientHandler"/>. /// </summary> /// <param name="abstraction">Instance of <see cref="IHttpClientHandler"/> to convert.</param> /// <returns>An instance of <see cref="HttpClientHandler"/>.</returns> public static HttpClientHandler ToImplementation(this IHttpClientHandler abstraction) { return(((IAbstraction <HttpClientHandler>)abstraction)?.UnsafeConvert()); }
/// <summary> /// Ansible Tower handler constructor /// </summary> /// <param name="ansibleTowerInstance"></param> /// <param name="circuitBreakerHttpClient"></param> public AnsibleTowerHandler(IAnsibleTowerInstance ansibleTowerInstance, IHttpClientHandler httpClientHandler) { HttpClientHandler = httpClientHandler; AnsibleTowerInstance = ansibleTowerInstance; }
public BingCustomSeacher(string subscriptionKey, string configID, IHttpClientHandler client) { SubscriptionKey = subscriptionKey; ConfigID = configID; _client = client; }
public StoryHttpClient(IHttpClientHandler httpClientHandler, IConfiguration configuration) { _httpClientHandler = httpClientHandler; this._configuration = configuration; }
public GlobalHashRateProvider(IHttpClientHandler httpClient) : base(httpClient) { }
public BitcoinWalletProvider(IHttpClientHandler httpClient) : base(httpClient) { }
public OwnerService(IHttpClientHandler httpHandler) { _httpHandler = httpHandler; }
public MarketStackService(IHttpClientHandler httpClientHandler, IStreamHandler streamHandler) { _httpClientHandler = httpClientHandler; _streamHandler = streamHandler; }