mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
Use EnsureSuccessStatusCode
This commit is contained in:
parent
722ec43e25
commit
e9911b70dd
@ -157,14 +157,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
{
|
{
|
||||||
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
|
||||||
using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
|
using var response = await httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
if (response.StatusCode != HttpStatusCode.OK)
|
|
||||||
{
|
|
||||||
throw new HttpException("Invalid image received.")
|
|
||||||
{
|
|
||||||
StatusCode = response.StatusCode
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var contentType = response.Content.Headers.ContentType.MediaType;
|
var contentType = response.Content.Headers.ContentType.MediaType;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user