diff --git a/src/main.rs b/src/main.rs index 1832e3a..e2cf4f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,10 +157,7 @@ async fn index(req: HttpRequest) -> Result> { } } - 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();