internal HttpClient(ClientConfig config, string clientSchema, string hostname, int hostPort, string basePath) { this.version = ".NET/" + loadVersion(); this.handler = new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; this.client = new System.Net.Http.HttpClient(handler); this.client.Timeout = TimeSpan.FromMilliseconds(config.ClientTimeout); this.client.MaxResponseContentBufferSize = config.MaxResponseContentBufferSize; if (String.IsNullOrEmpty(config.Token)) { this.credentialHandler = new ClientIdAndSecretCredentialHandler(config, client, clientSchema, hostname, hostPort); } else { this.credentialHandler = new StaticTokenCredentialHandler(config.Token); } this.compressionEnabled = config.CompressionEnabled; this.clientSchema = clientSchema; this.hostname = hostname; this.hostPort = hostPort; this.basePath = basePath; this.policy = config.ExponentialBackoffConfig.Policy(); }
internal HttpClient(ClientConfig config) { client = new System.Net.Http.HttpClient(); client.Timeout = TimeSpan.FromMilliseconds(config.ClientTimeout); client.MaxResponseContentBufferSize = config.MaxResponseContentBufferSize; credentialHandler = new CredentialHandler(config, client); enviroment = config.Environment; }
internal HttpClient(ClientConfig config, string clientSchema, string hostname, int hostPort, string basePath) { handler = new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; client = new System.Net.Http.HttpClient(handler); client.Timeout = TimeSpan.FromMilliseconds(config.ClientTimeout); client.MaxResponseContentBufferSize = config.MaxResponseContentBufferSize; credentialHandler = new CredentialHandler(config, client, clientSchema, hostname, hostPort); environment = config.Environment; compressionEnabled = config.CompressionEnabled; this.clientSchema = clientSchema; this.hostname = hostname; this.hostPort = hostPort; this.basePath = basePath; }
internal HttpClient(ClientConfig config) { // receiving compressed data is always allowed handler = new HttpClientHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; client = new System.Net.Http.HttpClient(handler); client.Timeout = TimeSpan.FromMilliseconds(config.ClientTimeout); client.MaxResponseContentBufferSize = config.MaxResponseContentBufferSize; credentialHandler = new CredentialHandler(config, client); environment = config.Environment; compressionEnabled = config.CompressionEnabled; clientSchema = DefaultClientSchema; hostname = HttpClient.addressMapping[environment]; hostPort = DefaultHostPort; basePath = DefaultBasePath; }