public void can_configure_client_from_factory() { var fac = new DefaultFlurlClientFactory() .ConfigureClient("http://api.com/foo", c => c.Settings.Timeout = TimeSpan.FromSeconds(123)); Assert.AreEqual(TimeSpan.FromSeconds(123), fac.Get("http://api.com/bar").Settings.Timeout); Assert.AreNotEqual(TimeSpan.FromSeconds(123), fac.Get("http://api2.com/foo").Settings.Timeout); }
public void default_factory_provides_same_client_per_host_scheme_port() { var fac = new DefaultFlurlClientFactory(); var cli1 = fac.Get("http://api.com/foo"); var cli2 = fac.Get("http://api.com/bar"); var cli3 = fac.Get("https://api.com/foo"); var cli4 = fac.Get("https://api.com/bar"); var cli5 = fac.Get("https://api.com:1234/foo"); var cli6 = fac.Get("https://api.com:1234/bar"); Assert.AreSame(cli1, cli2); Assert.AreSame(cli3, cli4); Assert.AreSame(cli5, cli6); Assert.AreNotSame(cli1, cli3); Assert.AreNotSame(cli3, cli5); }