internal HttpClient( string rootUrl, HttpClientSettings settings, IRequestRunner requestRunner) { this.settings = settings; settings.Validate(); this.requestRunner = requestRunner; merger = new ResourceMerger(settings.NamingConvention); Root = Resource.Create(rootUrl); }
public HttpClient(string rootUrl, HttpClientSettings settings) { settings.Validate(); requestRunner = new RequestRunner( new TransmissionSettings(settings.Serializers), settings.Authenticator, settings.CookieStrategy, settings.ArrayFormatter); merger = new ResourceMerger(settings.NamingConvention); UserAgent = settings.UserAgent; Root = new Resource(rootUrl); Logger = settings.Logger; }
internal HttpClient(string rootUrl, HttpClientSettings settings) { this.settings = settings; settings.Validate(); var cookieContainer = new CookieContainer(); var client = BuildSystemClient(cookieContainer, settings.DefaultTimeout); requestRunner = new RequestRunner( client, new TransmissionSettings(settings.Serializers), settings.ArrayFormatter, cookieContainer, settings.Middleware); merger = new ResourceMerger(settings.NamingConvention); Root = Resource.Create(rootUrl); }
/// <summary> /// Creates a new http client with custom settings /// </summary> /// <param name="rootUrl">The root url that all requests will be relative to</param> /// <param name="settings">The custom settings to use for this http client</param> /// <returns>A new http client</returns> public static IHttpClient Create(string rootUrl, HttpClientSettings settings) { return(new HttpClient(rootUrl, settings)); }