Convert content-type to lowercase for comparison
This commit is contained in:
parent
175b22006b
commit
e398376ab6
1 changed files with 2 additions and 2 deletions
|
|
@ -65,9 +65,9 @@ pub async fn fetch_object_http<T: Clone, Kind: DeserializeOwned>(
|
||||||
let content_type = res
|
let content_type = res
|
||||||
.content_type
|
.content_type
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|c| c.to_str().ok())
|
.and_then(|c| Some(c.to_str().ok()?.to_lowercase()))
|
||||||
.ok_or(Error::FetchInvalidContentType(res.url.clone()))?;
|
.ok_or(Error::FetchInvalidContentType(res.url.clone()))?;
|
||||||
if !VALID_RESPONSE_CONTENT_TYPES.contains(&content_type) {
|
if !VALID_RESPONSE_CONTENT_TYPES.contains(&content_type.as_str()) {
|
||||||
return Err(Error::FetchInvalidContentType(res.url));
|
return Err(Error::FetchInvalidContentType(res.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue