Skip to content

Commit

Permalink
fix: sharded client not applying proxy on GET /gateway/bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 12, 2024
1 parent a4d3dd9 commit 8ff8461
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion DisCatSharp/Clients/DiscordShardedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
Expand Down Expand Up @@ -371,8 +372,19 @@ internal async Task<int> InitializeShardsAsync()
/// </summary>
private async Task<GatewayInfo> GetGatewayInfoAsync()
{
var httphandler = new HttpClientHandler
{
UseCookies = false,
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
UseProxy = this._configuration.Proxy != null,
Proxy = this._configuration.Proxy
};
var url = $"{Utilities.GetApiBaseUri(this._configuration)}{Endpoints.GATEWAY}{Endpoints.BOT}";
var http = new HttpClient();
var http = new HttpClient(httphandler)
{
BaseAddress = new(Utilities.GetApiBaseUri(this._configuration)),
Timeout = this._configuration.HttpTimeout
};

http.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", Utilities.GetUserAgent());
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", Utilities.GetFormattedToken(this._configuration));
Expand Down

0 comments on commit 8ff8461

Please sign in to comment.