Skip to content

Commit

Permalink
feat: [#604] add timeout to http_health_check binary
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Jan 16, 2024
1 parent 1d9d4f3 commit 3e2b152
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bin/http_health_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
//!
//! - They are harder to maintain.
//! - They introduce new attack vectors.
use std::time::Duration;
use std::{env, process};

use reqwest::Client;

#[tokio::main]
async fn main() {
let args: Vec<String> = env::args().collect();
Expand All @@ -19,7 +22,9 @@ async fn main() {

let url = &args[1].clone();

match reqwest::get(url).await {
let client = Client::builder().timeout(Duration::from_secs(5)).build().unwrap();

match client.get(url).send().await {
Ok(response) => {
if response.status().is_success() {
println!("STATUS: {}", response.status());
Expand Down

0 comments on commit 3e2b152

Please sign in to comment.