Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Discord.Net.Rest/Net/DefaultRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal sealed class DefaultRestClient : IRestClient, IDisposable
private CancellationToken _cancelToken;
private bool _isDisposed;

public DefaultRestClient(string baseUrl, bool useProxy = false)
public DefaultRestClient(string baseUrl, bool useProxy = false, IWebProxy webProxy = null)
{
_baseUrl = baseUrl;

Expand All @@ -34,6 +34,7 @@ public DefaultRestClient(string baseUrl, bool useProxy = false)
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
UseCookies = false,
UseProxy = useProxy,
Proxy = webProxy
});
#pragma warning restore IDISP014
SetHeader("accept-encoding", "gzip, deflate");
Expand Down
5 changes: 3 additions & 2 deletions src/Discord.Net.Rest/Net/DefaultRestClientProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Net;

namespace Discord.Net.Rest
{
Expand All @@ -7,13 +8,13 @@ public static class DefaultRestClientProvider
public static readonly RestClientProvider Instance = Create();

/// <exception cref="PlatformNotSupportedException">The default RestClientProvider is not supported on this platform.</exception>
public static RestClientProvider Create(bool useProxy = false)
public static RestClientProvider Create(bool useProxy = false, IWebProxy webProxy = null)
{
return url =>
{
try
{
return new DefaultRestClient(url, useProxy);
return new DefaultRestClient(url, useProxy, webProxy);
}
catch (PlatformNotSupportedException ex)
{
Expand Down