Slapdash API call demo

I can hit the endpoint and retrieve data. Excellent.
This commit is contained in:
2025-05-22 17:45:57 -05:00
parent 3171c89248
commit 45b5049d0e
3 changed files with 51 additions and 0 deletions

26
src/main.rs Normal file
View File

@@ -0,0 +1,26 @@
use reqwest::Error;
use reqwest::header::{
USER_AGENT,
ACCEPT
};
#[tokio::main]
async fn main() -> Result<(), Error> {
let request_url = format!(
"http:/localhost:3000/api/v1/repos/{owner}/{repo}/releases",
owner = "robert",
repo = "rcalc",
);
let client = reqwest::Client::new();
let response = client
.get(request_url)
.header(USER_AGENT, "gt-tools-test-agent")
.header(ACCEPT, "application/json")
.send()
.await?;
let body_text: String = response.text().await?;
println!("{:?}", body_text);
Ok(())
}