Verifying solutions in Rust

rust
use serde::Deserialize;
use reqwest::{Error, Client, header::ACCEPT, header::CONTENT_TYPE};
use std::collections::HashMap;
#[derive(Deserialize, Debug)]
struct BotpoisonResponse {
ok: bool,
message: String,
}
#[tokio::main]
async fn main() -> Result<(), Error> {
let request_url = format!("https://api.botpoison.com/verify");
let secret_key = "sk_xxxxxxxx";
let solution = "..."; // Extract the solution from the request body (_botpoison)
let payload: HashMap<&str, &str> = [("secretKey", secret_key), ("solution", solution)].iter().cloned().collect();
let response: BotpoisonResponse = Client::new().post(request_url).header(ACCEPT, "application/json")
.header(CONTENT_TYPE, "application/json").json(&payload).send().await?.json().await?;
if response.ok {
println!("Not spam: allow request");
} else {
println!("Spam: reject request");
}
Ok(())
}