send user agent

This commit is contained in:
Richard
2026-01-28 22:04:45 +00:00
parent 7360f7ee70
commit 763e1346dd

View File

@@ -9,7 +9,7 @@ use tokio_tungstenite::{
connect_async_with_config,
tungstenite::{
client::IntoClientRequest,
http::header::{AUTHORIZATION, HeaderValue},
http::header::{AUTHORIZATION, HeaderValue, USER_AGENT},
Message,
},
};
@@ -69,6 +69,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
request.headers_mut().insert(AUTHORIZATION, auth_value);
}
let user_agent = format!("{}/{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
request
.headers_mut()
.insert(USER_AGENT, HeaderValue::from_str(&user_agent).unwrap());
info!("[{}] Connecting to {}", letter, url);
if debug_enabled {