Use EnsureSuccessStatusCode

This commit is contained in:
Gary Wilber 2020-09-28 15:37:10 -07:00
parent 722ec43e25
commit e9911b70dd
1 changed files with 1 additions and 8 deletions

View File

@ -157,14 +157,7 @@ namespace MediaBrowser.Providers.Manager
{
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new HttpException("Invalid image received.")
{
StatusCode = response.StatusCode
};
}
response.EnsureSuccessStatusCode();
var contentType = response.Content.Headers.ContentType.MediaType;