Provide user agent when performing HTTP requests (#15470)

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-07-30 11:12:37 +02:00 committed by GitHub
parent 2a649fa824
commit fa19bc98ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 40 additions and 24 deletions

View file

@ -541,9 +541,16 @@ impl Client {
}
pub fn production(cx: &mut AppContext) -> Arc<Self> {
let user_agent = format!(
"Zed/{} ({}; {})",
AppVersion::global(cx),
std::env::consts::OS,
std::env::consts::ARCH
);
let clock = Arc::new(clock::RealSystemClock);
let http = Arc::new(HttpClientWithUrl::new(
&ClientSettings::get_global(cx).server_url,
Some(user_agent),
ProxySettings::get_global(cx).proxy.clone(),
));
Self::new(clock, http.clone(), cx)