Simplify if unwrapping.

This commit is contained in:
Kavin 2022-11-03 21:53:03 +00:00
parent fa345b493b
commit 8755b0a76e
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -157,10 +157,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
}
}
let content_type = resp.headers().get("content-type");
if content_type.is_some() {
let content_type = content_type.unwrap();
if let Some(content_type) = resp.headers().get("content-type") {
if content_type == "image/jpeg" {
let resp_bytes = resp.bytes().await.unwrap();