diff --git a/src/main.rs b/src/main.rs index 02a47c6..70246f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,8 +16,7 @@ use xml::reader::{EventReader, XmlEvent}; fn publicise() { } -#[allow(unused)] -async fn get_folder_contents(password: String, url_tail: &str) -> Result> { +async fn get_folder_contents(password: String, url_tail: &str) -> Result> { debug!("Entering: get_folder_contents()"); let root_url = "https://theadamcooper.com"; let method = reqwest::Method::from_bytes(b"PROPFIND").unwrap(); @@ -36,13 +35,15 @@ async fn get_folder_contents(password: String, url_tail: &str) -> Result "#); - let response = client.request(method, url) + let response_text = client.request(method, url) .basic_auth("adam", Some(password)) .body(body) .send() + .await? + .text() .await?; - debug!("{:?}", response); - Ok(response) + debug!("{:?}", response_text); + Ok(response_text) } fn get_password() -> Result { @@ -57,13 +58,13 @@ fn get_password() -> Result { } #[tokio::main] -async fn main() -> Result<(), Box> { +async fn main() -> std::io::Result<()> { env_logger::Builder::from_env(Env::default().default_filter_or("trace")).target(Target::Stdout).init(); println!("Publicise it!"); - let password = get_password().unwrap(); - debug!("Received password: {}", password); + let password = get_password().unwrap().trim().to_string(); + debug!("Received password: {}[END]", password); - let folder_contents = get_folder_contents(password, "/nextcloud/remote.php/dav/files/adam/public").await?; + let folder_contents = get_folder_contents(password, "/nextcloud/remote.php/dav/files/adam/public").await; debug!("{:?}", folder_contents); Ok(()) }