This is supported on crate feature client only.
Expand description

Extensions to Config for custom Client.

See Client::new for an example.

This trait is sealed and cannot be implemented.

Required methods

Layer to set the base URI of requests to the configured server.

Optional layer to set up Authorization header depending on the config.

Layer to add non-authn HTTP headers depending on the config.

This is supported on crate feature native-tls only.

Create hyper_tls::HttpsConnector based on config.

Example
let config = Config::infer().await?;
let https = config.native_tls_https_connector()?;
let hyper_client: hyper::Client<_, hyper::Body> = hyper::Client::builder().build(https);
This is supported on crate feature rustls-tls only.

Create hyper_rustls::HttpsConnector based on config.

Example
let config = Config::infer().await?;
let https = config.rustls_https_connector()?;
let hyper_client: hyper::Client<_, hyper::Body> = hyper::Client::builder().build(https);
This is supported on crate feature native-tls only.

Create native_tls::TlsConnector based on config.

Example
let config = Config::infer().await?;
let https = {
    let tls = tokio_native_tls::TlsConnector::from(
        config.native_tls_connector()?
    );
    let mut http = HttpConnector::new();
    http.enforce_http(false);
    hyper_tls::HttpsConnector::from((http, tls))
};
This is supported on crate feature rustls-tls only.

Create rustls::ClientConfig based on config.

Example
let config = Config::infer().await?;
let https = {
    let rustls_config = std::sync::Arc::new(config.rustls_client_config()?);
    let mut http = HttpConnector::new();
    http.enforce_http(false);
    hyper_rustls::HttpsConnector::from((http, rustls_config))
};
This is supported on crate feature openssl-tls only.

Create hyper_openssl::HttpsConnector based on config.

Example
let config = Config::infer().await?;
let https = config.openssl_https_connector()?;
This is supported on crate feature openssl-tls only.

Create hyper_openssl::HttpsConnector based on config and connector.

Example
let mut http = HttpConnector::new();
http.enforce_http(false);
let config = Config::infer().await?;
let https = config.openssl_https_connector_with_connector(http)?;
This is supported on crate feature openssl-tls only.

Create openssl::ssl::SslConnectorBuilder based on config.

Example
let config = Config::infer().await?;
let https = {
    let mut http = HttpConnector::new();
    http.enforce_http(false);
    let ssl = config.openssl_ssl_connector_builder()?;
    hyper_openssl::HttpsConnector::with_connector(http, ssl)?
};

Implementors