Skip to main content

default_client

Function default_client 

Source
pub fn default_client() -> Client
Expand description

Builds a reqwest::Client with library defaults.

The client has a 60-second connect timeout and a 300-second read timeout: the read timeout applies to each read operation and resets after every successful read, so a streaming (SSE) response may run indefinitely as long as the server keeps sending data, while a connection that stalls mid-response still errors out after 300 idle seconds. Pass your own client to any request method if you need a different configuration (proxy, timeouts, pooling, …).

This function does not select a TLS backend: see the module docs for why, and install a provider (with install_crypto_provider under the ferritls feature, or one of your own) before the first client is built.

§Panics

Panics if no rustls crypto provider has been installed as the process default yet — reqwest’s rustls-no-provider build requires one at client construction time. This mirrors the panic behavior of reqwest::Client::new.