コード例 #1
0
ファイル: RestClient.cs プロジェクト: clickviewapp/Extensions
        /// <summary>
        /// Initializes a new instance of the <see cref="RestClient" /> class
        /// </summary>
        /// <param name="baseAddress"></param>
        /// <param name="options"></param>
        public RestClient(Uri baseAddress, RestClientOptions options = null)
        {
            _baseAddress = baseAddress ?? throw new ArgumentNullException(nameof(baseAddress));

            var o = options ?? RestClientOptions.Default;

            _options = o;

            _httpClient = CreateClient(o);
        }
コード例 #2
0
ファイル: RestClient.cs プロジェクト: clickviewapp/Extensions
        private static HttpClient CreateClient(RestClientOptions options)
        {
            var handler = new HttpClientHandler();

            if (handler.SupportsAutomaticDecompression)
            {
                handler.AutomaticDecompression = options.DecompressionMethods;
            }

            return(new HttpClient(handler)
            {
                Timeout = options.Timeout
            });
        }