caesar: change repo structure and rebuild

This commit is contained in:
Patryk Hegenberg 2024-04-10 23:53:40 +02:00
parent 1aba24bd5c
commit 4562c1c294
13 changed files with 165 additions and 143 deletions

23
src/sender.rs Normal file
View file

@ -0,0 +1,23 @@
use reqwest::{blocking::Client, StatusCode};
use std::collections::HashMap;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
pub fn send_info(client: Client, file: &str) -> Result<()> {
let mut map = HashMap::new();
map.insert("keyword", "test");
map.insert("files", file);
let res = client
.post("http://192.168.178.43:1323/upload")
.json(&map)
.send()?;
if res.status() == StatusCode::OK {
let json: HashMap<String, String> = res.json()?;
println!("JSON Response: {:?}", json);
} else {
println!("Error: Faile to send request");
}
Ok(())
}