mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 06:05:12 +00:00
added hook for providing a proxy to HttpClientAdapter
This commit is contained in:
@@ -18,6 +18,15 @@ namespace Octokit.Internal
|
||||
/// </remarks>
|
||||
public class HttpClientAdapter : IHttpClient
|
||||
{
|
||||
readonly IWebProxy webProxy;
|
||||
|
||||
public HttpClientAdapter() { }
|
||||
|
||||
public HttpClientAdapter(IWebProxy webProxy)
|
||||
{
|
||||
this.webProxy = webProxy;
|
||||
}
|
||||
|
||||
public async Task<IResponse<T>> Send<T>(IRequest request)
|
||||
{
|
||||
Ensure.ArgumentNotNull(request, "request");
|
||||
@@ -30,6 +39,12 @@ namespace Octokit.Internal
|
||||
{
|
||||
httpOptions.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
|
||||
}
|
||||
if (httpOptions.SupportsProxy && webProxy != null)
|
||||
{
|
||||
httpOptions.UseProxy = true;
|
||||
httpOptions.Proxy = webProxy;
|
||||
}
|
||||
|
||||
|
||||
var http = new HttpClient(httpOptions)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user