示例#1
0
        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);
        }
示例#2
0
        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;
        }
示例#3
0
        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);
        }
示例#4
0
 /// <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));
 }