This commit is contained in:
Felix Ableitner 2024-05-03 00:26:02 +02:00
parent c8b48371e0
commit dc1e5c995a

View file

@ -65,8 +65,7 @@ pub async fn fetch_object_http<T: Clone, Kind: DeserializeOwned>(
let content_type = res
.content_type
.as_ref()
.map(|c| c.to_str().ok())
.flatten()
.and_then(|c| c.to_str().ok())
.ok_or(Error::FetchInvalidContentType(res.url.clone()))?;
if !VALID_RESPONSE_CONTENT_TYPES.contains(&content_type) {
return Err(Error::FetchInvalidContentType(res.url));