Skip to content

Commit

Permalink
Dispose some objects when no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ErisApps committed Oct 14, 2021
1 parent 7992e1b commit 583b9eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CatCore/Services/Twitch/TwitchHelixApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ internal TwitchHelixApiService(ILogger logger, ITwitchAuthService twitchAuthServ

using var httpResponseMessage = await _combinedHelixPolicy.ExecuteAsync(() =>
{
var jsonContent = JsonContent.Create(body);
var httpRequestMessage = new HttpRequestMessage(httpMethod, url) {Content = jsonContent};
using var jsonContent = JsonContent.Create(body);
using var httpRequestMessage = new HttpRequestMessage(httpMethod, url) {Content = jsonContent};
return _helixClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead, cancellationToken ?? default);
}).ConfigureAwait(false);
if (!(httpResponseMessage?.IsSuccessStatusCode ?? false))
Expand Down Expand Up @@ -183,8 +183,8 @@ private async Task<bool> CallEndpointWithBodyNoBody<TBody>(HttpMethod httpMethod

using var httpResponseMessage = await _combinedHelixPolicy.ExecuteAsync(() =>
{
var jsonContent = JsonContent.Create(body);
var httpRequestMessage = new HttpRequestMessage(httpMethod, url) {Content = jsonContent};
using var jsonContent = JsonContent.Create(body);
using var httpRequestMessage = new HttpRequestMessage(httpMethod, url) { Content = jsonContent };
return _helixClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead, cancellationToken ?? default);
}).ConfigureAwait(false);
return httpResponseMessage?.IsSuccessStatusCode ?? false;
Expand Down

0 comments on commit 583b9eb

Please sign in to comment.