Rename AgentBuilder set_tls_config -> tls_config
For consistency. We don't use set_xxx on the builder.
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user