Add timeouts to HTTP requests (#3908)

This commit is contained in:
iequidoo
2023-01-11 11:55:42 -03:00
committed by iequidoo
parent 6642083f52
commit 6d9d31cad1
6 changed files with 25 additions and 4 deletions

12
src/http.rs Normal file
View File

@@ -0,0 +1,12 @@
//! # HTTP module.
use anyhow::Result;
use std::time::Duration;
const HTTP_TIMEOUT: Duration = Duration::from_secs(30);
pub(crate) fn get_client() -> Result<reqwest::Client> {
Ok(reqwest::ClientBuilder::new()
.timeout(HTTP_TIMEOUT)
.build()?)
}