Rename AgentBuilder set_tls_config -> tls_config

For consistency. We don't use set_xxx on the builder.
This commit is contained in:
Martin Algesten
2020-10-30 06:11:42 +01:00
parent a8ee8ab75e
commit d0789ae8e9
2 changed files with 3 additions and 3 deletions

View File

@@ -364,12 +364,12 @@ impl AgentBuilder {
/// ``` /// ```
/// let tls_config = std::sync::Arc::new(rustls::ClientConfig::new()); /// let tls_config = std::sync::Arc::new(rustls::ClientConfig::new());
/// let agent = ureq::builder() /// let agent = ureq::builder()
/// .set_tls_config(tls_config.clone()) /// .tls_config(tls_config.clone())
/// .build(); /// .build();
/// let req = agent.post("https://cool.server"); /// let req = agent.post("https://cool.server");
/// ``` /// ```
#[cfg(feature = "tls")] #[cfg(feature = "tls")]
pub fn set_tls_config(mut self, tls_config: Arc<rustls::ClientConfig>) -> Self { pub fn tls_config(mut self, tls_config: Arc<rustls::ClientConfig>) -> Self {
self.config.tls_config = Some(TLSClientConfig(tls_config)); self.config.tls_config = Some(TLSClientConfig(tls_config));
self self
} }

View File

@@ -105,7 +105,7 @@ fn tls_client_certificate() {
.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS); .add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
let agent = ureq::builder() let agent = ureq::builder()
.set_tls_config(std::sync::Arc::new(tls_config)) .tls_config(std::sync::Arc::new(tls_config))
.build(); .build();
let resp = agent.get("https://client.badssl.com/").call().unwrap(); let resp = agent.get("https://client.badssl.com/").call().unwrap();