headless_lms_utils/
http.rs1use headless_lms_base::config::bool_env_false_by_default;
2use once_cell::sync::Lazy;
3
4pub static REQWEST_CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
5 let http_test_mode: bool = bool_env_false_by_default("USE_MOCK_AZURE_CONFIGURATION")
8 || bool_env_false_by_default("TEST_MODE");
9 if http_test_mode {
10 warn!("Test environment. REQWEST_CLIENT is allowed to make http requests");
11 }
12
13 reqwest::Client::builder()
14 .use_rustls_tls()
15 .https_only(!http_test_mode)
16 .build()
17 .expect("Failed to build Client")
18});