use reqwest::Client;
use reqwest::StatusCode;
use crate::utils::error::Error;
pub async fn scanner<'a>(url: &String) -> Result<StatusCode, Error> {
let build_response = match Client::builder().build(){
Ok(good_client) => good_client,
Err(error) =>{
let errormsg = format!("TLS backend cannot be initialized, or the resolver cannot load the system configuration: {}", error);
return Err(Error::FatalError(errormsg));
}
};
let response = build_response.head(url).send();
match response.await {
Ok(response) => Ok(response.status()),
Err(error) =>{
let errormsg = format!("url could not be parsed: {}", error);
Err(Error::FatalError(errormsg))
},
}
}