Move the URL and HTTP Client out of match block
I'm going to need these in several of the arms.
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -9,14 +9,14 @@ use reqwest::header::{ACCEPT, USER_AGENT};
|
|||||||
async fn main() -> Result<(), Error> {
|
async fn main() -> Result<(), Error> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
|
let request_url = format!(
|
||||||
|
"http://localhost:3000/api/v1/repos/{owner}/{repo}/releases",
|
||||||
|
owner = "robert",
|
||||||
|
repo = "rcalc",
|
||||||
|
);
|
||||||
|
let client = reqwest::Client::new();
|
||||||
match args.command {
|
match args.command {
|
||||||
gt_tools::cli::Commands::ListReleases => {
|
gt_tools::cli::Commands::ListReleases => {
|
||||||
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
|
let response = client
|
||||||
.get(request_url)
|
.get(request_url)
|
||||||
.header(USER_AGENT, "gt-tools-test-agent")
|
.header(USER_AGENT, "gt-tools-test-agent")
|
||||||
|
|||||||
Reference in New Issue
Block a user