diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 15:23:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 15:23:52 +0900 |
| commit | 7f75c394502d32a9a8967dcf3602141098fdd07d (patch) | |
| tree | a608e90009d5664933fc5bba3cd08a5c7d2e5a48 /crates/mozart/src | |
| parent | 0a6bafc75f329910bcaeb7d83feee3f9b01db66b (diff) | |
| download | php-mozart-7f75c394502d32a9a8967dcf3602141098fdd07d.tar.gz php-mozart-7f75c394502d32a9a8967dcf3602141098fdd07d.tar.zst php-mozart-7f75c394502d32a9a8967dcf3602141098fdd07d.zip | |
refactor(http): centralize User-Agent string in mozart-core
Add mozart_core::http::user_agent() that returns a consistent
"Mozart/<version> (<os>; <arch>)" string. Replace all scattered
user-agent definitions across mozart-registry and mozart CLI commands.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src')
| -rw-r--r-- | crates/mozart/src/commands/diagnose.rs | 4 | ||||
| -rw-r--r-- | crates/mozart/src/commands/self_update.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/mozart/src/commands/diagnose.rs b/crates/mozart/src/commands/diagnose.rs index da37137..dc1ea85 100644 --- a/crates/mozart/src/commands/diagnose.rs +++ b/crates/mozart/src/commands/diagnose.rs @@ -83,7 +83,7 @@ async fn check_http_connectivity(url: &str) -> CheckResult { let client = match reqwest::Client::builder() .timeout(std::time::Duration::from_secs(10)) - .user_agent(concat!("mozart/", env!("CARGO_PKG_VERSION"))) + .user_agent(mozart_core::http::user_agent()) .build() { Ok(c) => c, @@ -111,7 +111,7 @@ async fn check_github_api() -> CheckResult { let client = match reqwest::Client::builder() .timeout(std::time::Duration::from_secs(10)) - .user_agent(concat!("mozart/", env!("CARGO_PKG_VERSION"))) + .user_agent(mozart_core::http::user_agent()) .build() { Ok(c) => c, diff --git a/crates/mozart/src/commands/self_update.rs b/crates/mozart/src/commands/self_update.rs index 9f6a7fe..ad9ae74 100644 --- a/crates/mozart/src/commands/self_update.rs +++ b/crates/mozart/src/commands/self_update.rs @@ -133,7 +133,7 @@ async fn fetch_releases(include_prerelease: bool) -> anyhow::Result<Vec<GitHubRe let client = reqwest::Client::builder() .timeout(std::time::Duration::from_secs(30)) - .user_agent(concat!("mozart/", env!("CARGO_PKG_VERSION"))) + .user_agent(mozart_core::http::user_agent()) .build() .map_err(|e| anyhow::anyhow!("Could not build HTTP client: {e}"))?; @@ -212,7 +212,7 @@ async fn download_asset( ) -> anyhow::Result<()> { let client = reqwest::Client::builder() .timeout(std::time::Duration::from_secs(300)) - .user_agent(concat!("mozart/", env!("CARGO_PKG_VERSION"))) + .user_agent(mozart_core::http::user_agent()) .build() .map_err(|e| anyhow::anyhow!("Could not build HTTP client: {e}"))?; |
