2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Set user-agent from cargo metadata

This commit is contained in:
asonix 2024-06-26 13:29:42 -05:00
parent 4b67c696d8
commit 62013068ca
2 changed files with 4 additions and 1 deletions

View file

@ -1586,9 +1586,11 @@ fn build_client_config() -> rustls::ClientConfig {
.with_no_client_auth()
}
const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), " ", env!("CARGO_PKG_VERSION"));
fn build_client() -> Result<ClientWithMiddleware, Error> {
let client = reqwest::Client::builder()
.user_agent("pict-rs v0.5.0-main")
.user_agent(USER_AGENT)
.use_preconfigured_tls(build_client_config())
.build()
.map_err(UploadError::BuildClient)?;

View file

@ -319,6 +319,7 @@ impl ObjectStore {
let https = endpoint.scheme() == "https";
let client_options = object_store::ClientOptions::new()
.with_user_agent(reqwest::header::HeaderValue::from_static(crate::USER_AGENT))
.with_timeout(Duration::from_secs(client_timeout))
.with_allow_http(!https);