diff --git a/src/main.rs b/src/main.rs index 6ac5272..05cfd48 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ use std::io::Read; use reqwest::header::{CONTENT_LENGTH, CONTENT_TYPE}; use std::fs::File; use std::io::{self, Write}; -use reqwest::blocking::Client; @@ -78,8 +77,11 @@ fn download(target: &str, quiet_mode: bool) -> Result<(), Box().ok()); - let ct_type = resp.headers().get(CONTENT_TYPE) - .and_then(|ct_type| ct_type.to_str().ok()); + let ct_type = headers.get(CONTENT_TYPE) + .and_then(|ct_type| ct_type.to_str().ok()) + .unwrap_or("unknown"); // provide a default value + + custom_print(format!("Type: {}", style(ct_type).green()), quiet_mode); match ct_len { Some(len) => { @@ -151,3 +153,10 @@ fn custom_print(message: String, quiet_mode: bool) { } } +fn parse_url(url: &str) -> Result> { + // Logic to parse and validate the URL + let parsed_url = reqwest::Url::parse(url)?; + Ok(parsed_url) +} + +