public void Should_Set_Client_Timeout()
        {
            var factory = new PerHostHttpClientFactory(TimeSpan.FromMinutes(15));
            var client  = factory.GetHttpClient("http://www.baidu.com");

            Assert.Equal(client.Timeout, TimeSpan.FromMinutes(15));
        }
        public void Should_Set_Client_Timeout_To_Default()
        {
            var factory = new PerHostHttpClientFactory();
            var client  = factory.GetHttpClient("http://www.baidu.com");

            Assert.Equal(client.Timeout, TimeSpan.FromSeconds(100));
        }
예제 #3
0
 public async Task Test_PerHostHttpClientFactory()
 {
     var factory = new PerHostHttpClientFactory();
     var client  = factory.GetHttpClient("http://www.baidu.com");
     var str     = await client.GetStringAsync("http://www.baidu.com");
 }