AsyncClient: Add the client version to the user-agent.

This commit is contained in:
Damir Jelić 2019-11-17 19:55:59 +01:00
parent 68102cc196
commit 88bfe1bec6

View file

@ -24,6 +24,7 @@ use crate::base_client::Client as BaseClient;
use crate::base_client::Room;
use crate::error::{Error, InnerError};
use crate::session::Session;
use crate::VERSION;
type RoomEventCallback = Box<dyn FnMut(&Room, &RoomEvent)>;
type RoomEventCallbackF = Box<
@ -171,7 +172,7 @@ impl AsyncClient {
let user_agent = match config.user_agent {
Some(a) => a,
None => HeaderValue::from_static("nio-rust"),
None => HeaderValue::from_str(&format!("nio-rust {}", VERSION)).unwrap(),
};
headers.insert(reqwest::header::USER_AGENT, user_agent);