diff --git a/src/Discord.Net.Rest/Net/HttpClientFactoryClientProvider.cs b/src/Discord.Net.Rest/Net/HttpClientFactoryClientProvider.cs index 88e80ad80..728eed3a0 100644 --- a/src/Discord.Net.Rest/Net/HttpClientFactoryClientProvider.cs +++ b/src/Discord.Net.Rest/Net/HttpClientFactoryClientProvider.cs @@ -8,12 +8,19 @@ using System.Threading.Tasks; namespace Discord.Rest.Net { + /// + /// This RestClientProvider creates the IRestClient used when using an IHttpClientFactory. + /// public class HttpClientFactoryRestClientProvider { public readonly RestClientProvider Instance; private readonly IHttpClientFactory _httpClientFactory; + /// + /// Constructs the HttpClientFactoryRestClientProvider, the idea is to use this with DI so that the parameters gets fed with the right HttpClientFactory. + /// + /// This is the IHttpClientFactory used. It should be fed through DI. public HttpClientFactoryRestClientProvider(IHttpClientFactory httpClientFactory) { _httpClientFactory = httpClientFactory; diff --git a/src/Discord.Net.Rest/Net/HttpClientFactoryRestClient.cs b/src/Discord.Net.Rest/Net/HttpClientFactoryRestClient.cs index 85e3b68c7..7a1154d1c 100644 --- a/src/Discord.Net.Rest/Net/HttpClientFactoryRestClient.cs +++ b/src/Discord.Net.Rest/Net/HttpClientFactoryRestClient.cs @@ -14,6 +14,9 @@ using System.Threading.Tasks; namespace Discord.Rest.Net { + /// + /// This HttpClientFactoryRestClient is the one used by HttpClientFactoryRestClientProvider. It accepts a preconfigured HttpClient. + /// internal sealed class HttpClientFactoryRestClient : IRestClient, IDisposable { private const int HR_SECURECHANNELFAILED = -2146233079; @@ -29,17 +32,17 @@ namespace Discord.Rest.Net _baseUrl = baseUrl; //this client would be given to use through DI. The advantage would be that it would be managed by DI, and no socket Exhaustation possible. _client = httpClient; -//#pragma warning disable IDISP014 -// _client = new HttpClient(new HttpClientHandler -// { -// AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, -// UseCookies = false, -// UseProxy = useProxy, -// }); -//#pragma warning restore IDISP014 - SetHeader("accept-encoding", "gzip, deflate"); + //#pragma warning disable IDISP014 + // _client = new HttpClient(new HttpClientHandler + // { + // AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, + // UseCookies = false, + // UseProxy = useProxy, + // }); + //#pragma warning restore IDISP014 + SetHeader("accept-encoding", "gzip, deflate"); //I will move this to the Extension method probably in another commit. - _cancelToken = CancellationToken.None; + _cancelToken = CancellationToken.None; _errorDeserializer = new JsonSerializer(); } private void Dispose(bool disposing)