protected RestClientBase(string baseAddress, Encoding encoding, IHttpCacheStore httpCacheStore, string userAgent = null) { if (encoding == null) { throw new NullReferenceException(); } if (httpCacheStore != null) { HttpClient = new HttpClient ( new HttpCacheHandler(httpCacheStore) { InnerHandler = new HttpClientHandler() } ); } else { HttpClient = new HttpClient(); } HttpClient.BaseAddress = new Uri(baseAddress); HttpClient.Timeout = TimeSpan.FromMilliseconds(10000); // HttpClient.DefaultRequestHeaders.UserAgent = userAgent; UserAgent = userAgent; BaseAddress = baseAddress; Encoding = encoding; }
public HttpCacheHandler(IHttpCacheStore httpCacheStore) { if (httpCacheStore == null) { throw new NullReferenceException(); } _httpCacheStore = httpCacheStore; }
public HttpCacheHandler(IHttpCacheStore httpCacheStore) { if (httpCacheStore == null) { throw new NullReferenceException(); } _httpCacheStore = httpCacheStore; }