This example below I found while looking answer to another quiestion.
Here that guy disposes response
in finally block.
Is it really necessary? Is it a GC's work in this case?
public static async Task EnsureSuccessStatusCodeAsync(this HttpResponseMessage response)
{
try
{
if (response.IsSuccessStatusCode)
return;
var content = await response.Content.ReadAsStringAsync();
throw new SimpleHttpResponseException(response.StatusCode, content);
}
finally
{
response.Content?.Dispose();
}
}