Skip to content

Commit

Permalink
fix: fix rest client
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 3, 2024
1 parent e0a1dad commit 0ccd184
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions DisCatSharp/Net/Rest/RestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ private async Task ExecuteFormRequestAsync(BaseRestRequest request, RateLimitBuc

if (this._useResetAfter)
{
if (bucket.ResetAfter.HasValue)
delay = bucket.ResetAfter.Value;
delay = bucket.ResetAfter.Value;
resetDate = bucket.ResetAfterOffset;
}

Expand Down Expand Up @@ -321,7 +320,7 @@ private async Task ExecuteFormRequestAsync(BaseRestRequest request, RateLimitBuc
var req = this.BuildFormRequest(request);

if (this.Debug && req.Content is not null)
this._logger.Log(this._discord?.Configuration.MinimumLogLevel ?? LogLevel.Trace, LoggerEvents.RestTx, "Rest Form Request Content:\n{Content}", await req.Content.ReadAsStringAsync()!);
this._logger.Log(LogLevel.Trace, LoggerEvents.RestTx, "Rest Form Request Content:\n{Content}", await req.Content.ReadAsStringAsync()!);

var response = new RestResponse();
try
Expand All @@ -335,7 +334,7 @@ private async Task ExecuteFormRequestAsync(BaseRestRequest request, RateLimitBuc
var txt = Utilities.UTF8.GetString(bts, 0, bts.Length);

if (this.Debug)
this._logger.Log(this._discord?.Configuration.MinimumLogLevel ?? LogLevel.Trace, LoggerEvents.RestRx, "Rest Form Response Content: {Content}", txt);
this._logger.Log(LogLevel.Trace, LoggerEvents.RestRx, "Rest Form Response Content: {Content}", txt);

response.Headers = res.Headers?.ToDictionary(xh => xh.Key, xh => string.Join("\n", xh.Value), StringComparer.OrdinalIgnoreCase);
response.Response = txt;
Expand Down Expand Up @@ -491,8 +490,7 @@ private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket?

if (this._useResetAfter)
{
if (bucket.ResetAfter.HasValue)
delay = bucket.ResetAfter.Value;
delay = bucket.ResetAfter.Value;
resetDate = bucket.ResetAfterOffset;
}

Expand Down Expand Up @@ -521,7 +519,7 @@ private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket?
var req = this.BuildRequest(request);

if (this.Debug && req.Content is not null)
this._logger.Log(this._discord?.Configuration.MinimumLogLevel ?? LogLevel.Trace, LoggerEvents.RestTx, "Rest Request Content:\n{Content}", await req.Content.ReadAsStringAsync());
this._logger.Log(LogLevel.Trace, LoggerEvents.RestTx, "Rest Request Content:\n{Content}", await req.Content.ReadAsStringAsync());

var response = new RestResponse();
try
Expand All @@ -534,7 +532,7 @@ private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket?
var txt = Utilities.UTF8.GetString(bts, 0, bts.Length);

if (this.Debug)
this._logger.Log(this._discord?.Configuration.MinimumLogLevel ?? LogLevel.Trace, LoggerEvents.RestRx, "Rest Response Content: {Content}", txt);
this._logger.Log(LogLevel.Trace, LoggerEvents.RestRx, "Rest Response Content: {Content}", txt);

response.Headers = res.Headers?.ToDictionary(xh => xh.Key, xh => string.Join("\n", xh.Value), StringComparer.OrdinalIgnoreCase);
response.Response = txt;
Expand Down

0 comments on commit 0ccd184

Please sign in to comment.