summaryrefslogtreecommitdiff
path: root/src/api/mod.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-01 07:10:44 -0500
committerseth <[email protected]>2023-12-01 07:12:49 -0500
commitf997cbdaea8364880f3a9b3743131c0ab5a60534 (patch)
tree5ab827d5827d27d9f0ff6770b1dfcd210904f243 /src/api/mod.rs
parent85402f9103b55dff65c6a6079c6902080e5a30a6 (diff)
fix: report user agent in /version correctly
Diffstat (limited to 'src/api/mod.rs')
-rw-r--r--src/api/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs
index 2ce664e..d9eaef2 100644
--- a/src/api/mod.rs
+++ b/src/api/mod.rs
@@ -3,13 +3,15 @@ use once_cell::sync::Lazy;
pub mod guzzle;
pub mod shiggy;
-pub const USER_AGENT: &str = "teawieBot/";
-
-pub static REQWEST_CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
+pub static USER_AGENT: Lazy<String> = Lazy::new(|| {
let version = option_env!("CARGO_PKG_VERSION").unwrap_or("development");
+ format!("teawieBot/{version}")
+});
+
+pub static REQWEST_CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
reqwest::Client::builder()
- .user_agent(format!("{USER_AGENT}/{version}"))
+ .user_agent(format!("{:#?}", USER_AGENT))
.build()
.unwrap_or_default()
});