|
@ -14,16 +14,16 @@ struct Cli { |
|
|
#[tokio::main] |
|
|
#[tokio::main] |
|
|
|
|
|
|
|
|
async fn main() -> Result<(), reqwest::Error> { |
|
|
async fn main() -> Result<(), reqwest::Error> { |
|
|
// Some simple CLI args requirements...
|
|
|
|
|
|
let args = Cli::parse(); |
|
|
let args = Cli::parse(); |
|
|
let url = args.url; |
|
|
let url = args.url; |
|
|
let text = args.text; |
|
|
let text = args.text; |
|
|
|
|
|
|
|
|
let client = reqwest::Client::new(); |
|
|
let client = reqwest::Client::new(); |
|
|
let res = client.post(url).body(text).send().await?; |
|
|
let res = client.post(url).form(&[("text", text)]).send().await?; |
|
|
|
|
|
|
|
|
eprintln!("Response: {:?} {}", res.version(), res.status()); |
|
|
eprintln!("Response: {:?} {}", res.version(), res.status()); |
|
|
eprintln!("Headers: {:#?}\n", res.headers()); |
|
|
eprintln!("Headers: {:#?}\n", res.headers()); |
|
|
|
|
|
|
|
|
let body = res.text().await?; |
|
|
let body = res.text().await?; |
|
|
println!("{}", body); |
|
|
println!("{}", body); |
|
|
Ok(()) |
|
|
Ok(()) |
|
|