use anyhow::{Context, Result};
use serde_json::json;
fn main() -> Result<()> {
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.context("Tokio runtime creation failed")?;
rt.block_on(quick_dev())
}
async fn quick_dev() -> Result<()> {
let hc = httpc_test::new_client("http://localhost:3000")?;
hc.do_get("/hello2/Wilson").await?.print().await?;
// let req_login = hc.do_post(
// "/api/login",
// json!({
// "username": "demo1",
// "pwd": "welcome"
// }),
// );
// req_login.await?.print().await?;
let req_create_ticket = hc.do_post(
"/api/tickets",
json!({
"title": "Ticket AAA"
}),
);
req_create_ticket.await?.print().await?;
hc.do_get("/api/tickets").await?.print().await?;
Ok(())
}