Dispose httpclient response

pull/3895/head
crobibero 4 years ago
parent 8ddcd12348
commit 8da646e12b

@ -1071,7 +1071,7 @@ namespace Jellyfin.Api.Controllers
{
var client = _httpClientFactory.CreateClient();
// https://json.schedulesdirect.org/20141201/available/countries
var response = await client.GetAsync("https://json.schedulesdirect.org/20141201/available/countries")
using var response = await client.GetAsync("https://json.schedulesdirect.org/20141201/available/countries")
.ConfigureAwait(false);
return File(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), MediaTypeNames.Application.Json);

@ -245,7 +245,7 @@ namespace Jellyfin.Api.Controllers
private async Task DownloadImage(string url, Guid urlHash, string pointerCachePath)
{
var httpClient = _httpClientFactory.CreateClient();
var response = await httpClient.GetAsync(url).ConfigureAwait(false);
using var response = await httpClient.GetAsync(url).ConfigureAwait(false);
var ext = response.Content.Headers.ContentType.MediaType.Split('/').Last();
var fullCachePath = GetFullCachePath(urlHash + "." + ext);

Loading…
Cancel
Save