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

@ -995,7 +995,8 @@ impl Server {
tracing::Span::current().record("connection_id", format!("{}", connection_id));
tracing::info!("connection opened");
let http_client = match IsahcHttpClient::new() {
let user_agent = format!("Zed Server/{}", env!("CARGO_PKG_VERSION"));
let http_client = match IsahcHttpClient::builder().default_header("User-Agent", user_agent).build() {
Ok(http_client) => Arc::new(http_client),
Err(error) => {
tracing::error!(?error, "failed to create HTTP client");