mirror of
https://github.com/ultraworkers/claw-code.git
synced 2026-05-31 21:04:16 +08:00
fix: unify user_agent to 'clawd-rust-tools/0.1'
Sets user_agent on both build_http_client_or_default() and build_http_client_with() to 'clawd-rust-tools/0.1' for consistent HTTP client identification.
This commit is contained in:
parent
c881069ff8
commit
a61d023583
@ -71,7 +71,12 @@ pub fn build_http_client() -> Result<reqwest::Client, ApiError> {
|
|||||||
/// first outbound request instead of at construction time.
|
/// first outbound request instead of at construction time.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn build_http_client_or_default() -> reqwest::Client {
|
pub fn build_http_client_or_default() -> reqwest::Client {
|
||||||
build_http_client().unwrap_or_else(|_| reqwest::Client::new())
|
build_http_client().unwrap_or_else(|_| {
|
||||||
|
reqwest::Client::builder()
|
||||||
|
.user_agent("clawd-rust-tools/0.1")
|
||||||
|
.build()
|
||||||
|
.expect("default client with user_agent should always succeed")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Build a `reqwest::Client` from an explicit [`ProxyConfig`]. Used by tests
|
/// Build a `reqwest::Client` from an explicit [`ProxyConfig`]. Used by tests
|
||||||
@ -81,7 +86,9 @@ pub fn build_http_client_or_default() -> reqwest::Client {
|
|||||||
/// and `https_proxy` fields and is registered as both an HTTP and HTTPS
|
/// and `https_proxy` fields and is registered as both an HTTP and HTTPS
|
||||||
/// proxy so a single value can route every outbound request.
|
/// proxy so a single value can route every outbound request.
|
||||||
pub fn build_http_client_with(config: &ProxyConfig) -> Result<reqwest::Client, ApiError> {
|
pub fn build_http_client_with(config: &ProxyConfig) -> Result<reqwest::Client, ApiError> {
|
||||||
let mut builder = reqwest::Client::builder().no_proxy();
|
let mut builder = reqwest::Client::builder()
|
||||||
|
.no_proxy()
|
||||||
|
.user_agent("clawd-rust-tools/0.1");
|
||||||
|
|
||||||
let no_proxy = config
|
let no_proxy = config
|
||||||
.no_proxy
|
.no_proxy
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user