# reqwest 0.13.5

> The `reqwest` crate provides a convenient, higher-level HTTP

## reqwest


The `reqwest` crate provides a convenient, higher-level HTTP
[`Client`][client].

It handles many of the things that most people just expect an HTTP client
to do for them.

- Async and [blocking] Clients
- Plain bodies, [JSON](#json), [urlencoded](#forms), [multipart]
- Customizable [redirect policy](#redirect-policies)
- HTTP [Proxies](#proxies)
- Uses [TLS](#tls) by default
- Cookies

The [`reqwest::Client`][client] is asynchronous (requiring Tokio). For
applications wishing  to only make a few HTTP requests, the
[`reqwest::blocking`](blocking) API may be more convenient.

Additional learning resources include:

- [The Rust Cookbook](https://rust-lang-nursery.github.io/rust-cookbook/web/clients.html)
- [reqwest Repository Examples](https://github.com/seanmonstar/reqwest/tree/master/examples)

### reqwest › Commercial Support

For private advice, support, reviews, access to the maintainer, and the
like, reach out for [commercial support][sponsor].

### reqwest › Making a GET request

For a single request, you can use the [`get`][get] shortcut method.

```rust
# async fn run() -> Result<(), reqwest::Error> {
let body = reqwest::get("https://www.rust-lang.org")
    .await?
    .text()
    .await?;

println!("body = {body:?}");
# Ok(())
# }
```

**NOTE**: If you plan to perform multiple requests, it is best to create a
[`Client`][client] and reuse it, taking advantage of keep-alive connection
pooling.

### reqwest › Making POST requests (or setting request bodies)

There are several ways you can set the body of a request. The basic one is
by using the `body()` method of a [`RequestBuilder`][builder]. This lets you set the
exact raw bytes of what the body should be. It accepts various types,
including `String` and `Vec<u8>`. If you wish to pass a custom
type, you can use the `reqwest::Body` constructors.

```rust
# use reqwest::Error;
#
# async fn run() -> Result<(), Error> {
let client = reqwest::Client::new();
let res = client.post("http://httpbin.org/post")
    .body("the exact body that is sent")
    .send()
    .await?;
# Ok(())
# }
```

### reqwest › Forms

It's very common to want to send form data in a request body. This can be
done with any type that can be serialized into form data.

This can be an array of tuples, or a `HashMap`, or a custom type that
implements [`Serialize`][serde].

The feature `form` is required.

```rust
# use reqwest::Error;
#
# #[cfg(feature = "form")]
# async fn run() -> Result<(), Error> {
// This will POST a body of `foo=bar&baz=quux`
let params = [("foo", "bar"), ("baz", "quux")];
let client = reqwest::Client::new();
let res = client.post("http://httpbin.org/post")
    .form(&params)
    .send()
    .await?;
# Ok(())
# }
```

### reqwest › JSON

There is also a `json` method helper on the [`RequestBuilder`][builder] that works in
a similar fashion the `form` method. It can take any value that can be
serialized into JSON.

The feature `json` is required.

```rust
# use reqwest::Error;
# use std::collections::HashMap;
#
# #[cfg(feature = "json")]
# async fn run() -> Result<(), Error> {
// This will POST a body of `{"lang":"rust","body":"json"}`
let mut map = HashMap::new();
map.insert("lang", "rust");
map.insert("body", "json");

let client = reqwest::Client::new();
let res = client.post("http://httpbin.org/post")
    .json(&map)
    .send()
    .await?;
# Ok(())
# }
```

### reqwest › Redirect Policies

By default, a `Client` will automatically handle HTTP redirects, having a
maximum redirect chain of 10 hops. To customize this behavior, a
[`redirect::Policy`][redirect] can be used with a `ClientBuilder`.

### reqwest › Cookies

The automatic storing and sending of session cookies can be enabled with
the [`cookie_store`][ClientBuilder::cookie_store] method on `ClientBuilder`.

### reqwest › Proxies

**NOTE**: System proxies are enabled by default.

System proxies look in environment variables to set HTTP or HTTPS proxies.

`HTTP_PROXY` or `http_proxy` provide HTTP proxies for HTTP connections while
`HTTPS_PROXY` or `https_proxy` provide HTTPS proxies for HTTPS connections.
`ALL_PROXY` or `all_proxy` provide proxies for both HTTP and HTTPS connections.
If both the all proxy and HTTP or HTTPS proxy variables are set the more specific
HTTP or HTTPS proxies take precedence.

These can be overwritten by adding a [`Proxy`] to `ClientBuilder`
i.e. `let proxy = reqwest::Proxy::http("https://secure.example")?;`
or disabled by calling `ClientBuilder::no_proxy()`.

`socks` feature is required if you have configured socks proxy like this:

```bash
export https_proxy=socks5://127.0.0.1:1086
```

### reqwest › TLS

A `Client` will use transport layer security (TLS) by default to connect to
HTTPS destinations.

- Additional server certificates can be configured on a `ClientBuilder`
  with the [`Certificate`] type.
- Client certificates can be added to a `ClientBuilder` with the
  [`Identity`] type.
- Various parts of TLS can also be configured or even disabled on the
  `ClientBuilder`.

See more details in the [`tls`] module.

### reqwest › WASM

The Client implementation automatically switches to the WASM one when the target_arch is wasm32,
the usage is basically the same as the async api. Some of the features are disabled in wasm
: [`tls`], [`cookie`], [`blocking`], as well as various `ClientBuilder` methods such as `timeout()` and `connector_layer()`.

TLS and cookies are provided through the browser environment, so reqwest can issue TLS requests with cookies,
but has limited configuration.

### reqwest › Optional Features

The following are a list of [Cargo features][cargo-features] that can be
enabled or disabled:

- **http2** *(enabled by default)*: Enables HTTP/2 support.
- **default-tls** *(enabled by default)*: Provides TLS support to connect
  over HTTPS.
- **rustls**: Enables TLS functionality provided by `rustls`.
- **rustls-no-provider**: Enables TLS provided by `rustls` without specifying a crypto provider.
- **native-tls**: Enables TLS functionality provided by `native-tls`.
- **native-tls-vendored**: Enables the `vendored` feature of `native-tls`.
- **native-tls-no-alpn**: Enables `native-tls` without its `alpn` feature.
- **native-tls-vendored-no-alpn**: Enables `native-tls-vendored` without its `alpn` feature.
- **blocking**: Provides the [blocking][] client API.
- **charset** *(enabled by default)*: Improved support for decoding text.
- **cookies**: Provides cookie session support.
- **gzip**: Provides response body gzip decompression.
- **brotli**: Provides response body brotli decompression.
- **zstd**: Provides response body zstd decompression.
- **deflate**: Provides response body deflate decompression.
- **query**: Provides query parameter serialization.
- **form**: Provides form data serialization.
- **json**: Provides serialization and deserialization for JSON bodies.
- **multipart**: Provides functionality for multipart forms.
- **stream**: Adds support for `futures::Stream`.
- **socks**: Provides SOCKS5 proxy support.
- **hickory-dns**: Enables a hickory-dns async resolver instead of default
  threadpool using `getaddrinfo`.
- **system-proxy** *(enabled by default)*: Use Windows and macOS system
  proxy settings automatically.

### reqwest › Unstable Features

Some feature flags require additional opt-in by the application, by setting
a `reqwest_unstable` flag.

- **http3** *(unstable)*: Enables support for sending HTTP/3 requests.

These features are unstable, and experimental. Details about them may be
changed in patch releases.

You can pass such a flag to the compiler via `.cargo/config`, or
environment variables, such as:

```notrust
RUSTFLAGS="--cfg reqwest_unstable" cargo build
```

### reqwest › Sponsors

Support this project by becoming a [sponsor][].

[hyper]: https://hyper.rs
[blocking]: ./blocking/index.html
[client]: ./struct.Client.html
[response]: ./struct.Response.html
[get]: ./fn.get.html
[builder]: ./struct.RequestBuilder.html
[serde]: http://serde.rs
[redirect]: crate::redirect
[Proxy]: ./struct.Proxy.html
[cargo-features]: https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-features-section
[sponsor]: https://seanmonstar.com/sponsor

## reqwest::async_impl::multipart (module)

multipart/form-data

## reqwest::blocking (module)

A blocking Client API.

The blocking `Client` will block the current thread to execute, instead
of returning futures that need to be executed on a runtime.

Conversely, the functionality in `reqwest::blocking` must *not* be executed
within an async runtime, or it will panic when attempting to block. If
calling directly from an async function, consider using an async
[`reqwest::Client`][crate::Client] instead. If the immediate context is only
synchronous, but a transitive caller is async, consider changing that caller
to use [`tokio::task::spawn_blocking`] around the calls that need to block.

### reqwest::blocking (module) › Optional

This requires the optional `blocking` feature to be enabled.

### reqwest::blocking (module) › Making a GET request

For a single request, you can use the [`get`] shortcut method.

```rust
# use reqwest::{Error, Response};

# fn run() -> Result<(), Error> {
let body = reqwest::blocking::get("https://www.rust-lang.org")?
    .text()?;

println!("body = {body:?}");
# Ok(())
# }
```

Additionally, the blocking [`Response`] struct implements Rust's
`Read` trait, so many useful standard library and third party crates will
have convenience methods that take a `Response` anywhere `T: Read` is
acceptable.

**NOTE**: If you plan to perform multiple requests, it is best to create a
[`Client`] and reuse it, taking advantage of keep-alive connection pooling.

### reqwest::blocking (module) › Making POST requests (or setting request bodies)

There are several ways you can set the body of a request. The basic one is
by using the `body()` method of a [`RequestBuilder`]. This lets you set the
exact raw bytes of what the body should be. It accepts various types,
including `String`, `Vec<u8>`, and `File`. If you wish to pass a custom
Reader, you can use the `reqwest::blocking::Body::new()` constructor.

```rust
# use reqwest::Error;
#
# fn run() -> Result<(), Error> {
let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org/post")
    .body("the exact body that is sent")
    .send()?;
# Ok(())
# }
```

### reqwest::blocking (module) › And More

Most features available to the asynchronous `Client` are also available,
on the blocking `Client`, see those docs for more.

## reqwest::blocking::multipart (module)

multipart/form-data

To send a `multipart/form-data` body, a [`Form`] is built up, adding
fields or customized [`Part`]s, and then calling the
[`multipart`][builder] method on the `RequestBuilder`.

### reqwest::blocking::multipart (module) › Example

```
use reqwest::blocking::multipart;

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let form = multipart::Form::new()
    // Adding just a simple text field...
    .text("username", "seanmonstar")
    // And a file...
    .file("photo", "/path/to/photo.png")?;

// Customize all the details of a Part if needed...
let bio = multipart::Part::text("hallo peeps")
    .file_name("bio.txt")
    .mime_str("text/plain")?;

// Add the custom part to our form...
let form = form.part("biography", bio);

// And finally, send the form
let client = reqwest::blocking::Client::new();
let resp = client
    .post("http://localhost:8080/user")
    .multipart(form)
    .send()?;
# Ok(())
# }
# fn main() {}
```

[builder]: ../struct.RequestBuilder.html#method.multipart

## reqwest::cookie (module)

HTTP Cookies

## reqwest::dns (module)

DNS resolution

## reqwest::redirect (module)

Redirect Handling

By default, a `Client` will automatically handle HTTP redirects, having a
maximum redirect chain of 10 hops. To customize this behavior, a
`redirect::Policy` can be used with a `ClientBuilder`.

## reqwest::retry (module)

Retry requests

A `Client` has the ability to retry requests, by sending additional copies
to the server if a response is considered retryable.

The [`Builder`] makes it easier to configure what requests to retry, along
with including best practices by default, such as a retry budget.

### reqwest::retry (module) › Defaults

The default retry behavior of a `Client` is to only retry requests where an
error or low-level protocol NACK is encountered that is known to be safe to
retry. Note however that providing a specific retry policy will override
the default, and you will need to explicitly include that behavior.

All policies default to including a retry budget that permits 20% extra
requests to be sent.

### reqwest::retry (module) › Scoped

A client's retry policy is scoped. That means that the policy doesn't
apply to all requests, but only those within a user-defined scope.

Since all policies include a budget by default, it doesn't make sense to
apply it on _all_ requests. Rather, the retry history applied by a budget
should likely only be applied to the same host.

### reqwest::retry (module) › Classifiers

A retry policy needs to be configured with a classifier that determines
if a request should be retried. Knowledge of the destination server's
behavior is required to make a safe classifier. **Requests should not be
retried** if the server cannot safely handle the same request twice, or if
it causes side effects.

Some common properties to check include if the request method is
idempotent, or if the response status code indicates a transient error.

## reqwest::tls (module)

TLS configuration and types

A `Client` will use transport layer security (TLS) by default to connect to
HTTPS destinations.

### reqwest::tls (module) › Backends

reqwest supports several TLS backends, enabled with Cargo features.

### reqwest::tls (module) › default-tls

reqwest will pick a TLS backend by default. This is true when the
`default-tls` feature is enabled.

While it currently uses `rustls`, the feature set is designed to only
enable configuration that is shared among available backends. This allows
reqwest to change the default to `native-tls` (or another) by configuration.

<div class="warning">This feature is enabled by default, and takes
precedence if any other crate enables it. This is true even if you declare
`features = []`. You must set `default-features = false` instead.</div>

Since Cargo features are additive, other crates in your dependency tree can
cause the default backend to be enabled. If you wish to ensure your
`Client` uses a specific backend, call the appropriate builder methods
(such as [`tls_backend_rustls()`][]).

[`tls_backend_rustls()`]: crate::ClientBuilder::tls_backend_rustls()

### reqwest::tls (module) › native-tls

This backend uses the [native-tls][] crate. That will try to use the system
TLS on Windows and Mac, and OpenSSL on Linux targets.

Enabling the feature explicitly allows for `native-tls`-specific
configuration options.

[native-tls]: https://crates.io/crates/native-tls

### reqwest::tls (module) › rustls

This backend uses the [rustls][] crate, a TLS library written in Rust.

[rustls]: https://crates.io/crates/rustls

### reqwest::tls (module) › rustls-no-provider

Like `rustls`, but without a built-in crypto provider. This is useful when
you want to supply your own [rustls CryptoProvider][], for example to use
[ring][] instead of the default `aws-lc-rs`.

**You must install a crypto provider before building a `Client`.** If none
is installed the client will panic at construction time. Install one via
[`CryptoProvider::install_default`][]:

```rust,ignore
rustls::crypto::ring::default_provider()
    .install_default()
    .expect("Failed to install rustls crypto provider");

let client = reqwest::Client::new();
```

[rustls CryptoProvider]: https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html
[ring]: https://crates.io/crates/ring
[`CryptoProvider::install_default`]: https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html#method.install_default

## reqwest (impl)

A `Response` can be converted into a `http::Response`.

## reqwest (impl)

A `Response` can be piped as the `Body` of another request.

## reqwest::TLS_1_0 (assoc_const)

Version 1.0 of the TLS protocol.

## reqwest::TLS_1_1 (assoc_const)

Version 1.1 of the TLS protocol.

## reqwest::TLS_1_2 (assoc_const)

Version 1.2 of the TLS protocol.

## reqwest::TLS_1_3 (assoc_const)

Version 1.3 of the TLS protocol.

## reqwest::add_cookie_str (function)

Add a cookie to this jar.

### reqwest::add_cookie_str (function) › Example

```
use reqwest::{cookie::Jar, Url};

let cookie = "foo=bar; Domain=yolo.local";
let url = "https://yolo.local".parse::<Url>().unwrap();

let jar = Jar::default();
jar.add_cookie_str(cookie, &url);

// and now add to a `ClientBuilder`?
```

## reqwest::add_crl (function)

Deprecated: use [`ClientBuilder::tls_crls_only()`] instead.

## reqwest::add_crl (function)

Deprecated: use [`ClientBuilder::tls_crls_only()`] instead.

## reqwest::add_crls (function)

Deprecated: use [`ClientBuilder::tls_crls_only()`] instead.

## reqwest::add_crls (function)

Deprecated: use [`ClientBuilder::tls_crls_only()`] instead.

## reqwest::add_root_certificate (function)

Deprecated: use [`ClientBuilder::tls_certs_merge()`] or
[`ClientBuilder::tls_certs_only()`] instead.

## reqwest::add_root_certificate (function)

Deprecated: use [`ClientBuilder::tls_certs_merge()`] or [`ClientBuilder::tls_certs_only()`] instead.

## reqwest::all (function)

Proxy **all** traffic to the passed URL.

"All" refers to `https` and `http` URLs. Other schemes are not
recognized by reqwest.

### reqwest::all (function) › Example

```
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
    .proxy(reqwest::Proxy::all("http://pro.xy")?)
    .build()?;
# Ok(())
# }
# fn main() {}
```

## reqwest::as_bytes (function)

Returns a reference to the internal data of the `Body`.

`None` is returned, if the underlying data is a stream.

## reqwest::as_bytes (function)

Returns the body as a byte slice if the body is already buffered in
memory. For streamed requests this method returns `None`.

## reqwest::as_str (function)

View the name as a string.

## reqwest::async_impl::body::Body (struct)

An asynchronous request body.

## reqwest::async_impl::client::Client (struct)

An asynchronous `Client` to make Requests with.

The Client has various configuration values to tweak, but the defaults
are set to what is usually the most commonly desired value. To configure a
`Client`, use `Client::builder()`.

The `Client` holds a connection pool internally to improve performance
by reusing connections and avoiding setup overhead, so it is advised that
you create one and **reuse** it.

You do **not** have to wrap the `Client` in an [`Rc`] or [`Arc`] to **reuse** it,
because it already uses an [`Arc`] internally.

### reqwest::async_impl::client::Client (struct) › Connection Pooling

The connection pool can be configured using [`ClientBuilder`] methods
with the `pool_` prefix, such as [`ClientBuilder::pool_idle_timeout`]
and [`ClientBuilder::pool_max_idle_per_host`].

[`Rc`]: std::rc::Rc

## reqwest::async_impl::client::ClientBuilder (struct)

A `ClientBuilder` can be used to create a `Client` with custom configuration.

## reqwest::async_impl::client::ClientBuilder::cookie_provider (function)

Set the persistent cookie store for the client.

Cookies received in responses will be passed to this store, and
additional requests will query this store for cookies.

By default, no cookie store is used. It is **not** necessary to also call
[cookie_store(true)](crate::ClientBuilder::cookie_store) if [cookie_provider(my_cookie_store)](crate::ClientBuilder::cookie_provider) is used; calling
[cookie_store(true)](crate::ClientBuilder::cookie_store) _after_ [cookie_provider(my_cookie_store)](crate::ClientBuilder::cookie_provider) will result
in the provided `my_cookie_store` being **overridden** with a default implementation.

### reqwest::async_impl::client::ClientBuilder::cookie_provider (function) › Optional

This requires the optional `cookies` feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::cookie_store (function)

Enable a persistent cookie store for the client.

Cookies received in responses will be preserved and included in
additional requests.

By default, no cookie store is used. Enabling the cookie store
with `cookie_store(true)` will set the store to a default implementation.
It is **not** necessary to call [cookie_store(true)](crate::ClientBuilder::cookie_store) if [cookie_provider(my_cookie_store)](crate::ClientBuilder::cookie_provider)
is used; calling [cookie_store(true)](crate::ClientBuilder::cookie_store) _after_ [cookie_provider(my_cookie_store)](crate::ClientBuilder::cookie_provider) will result
in the provided `my_cookie_store` being **overridden** with a default implementation.

### reqwest::async_impl::client::ClientBuilder::cookie_store (function) › Optional

This requires the optional `cookies` feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::pool_idle_timeout (function)

Set an optional timeout for idle sockets being kept-alive.

Pass `None` to disable timeout.

Default is 90 seconds.

## reqwest::async_impl::client::ClientBuilder::pool_max_idle_per_host (function)

Sets the maximum idle connection per host allowed in the pool.

Default is `usize::MAX` (no limit).

## reqwest::async_impl::client::ClientBuilder::tls_backend_native (function)

Force using the native TLS backend.

Since multiple TLS backends can be optionally enabled, this option will
force the `native-tls` backend to be used for this `Client`.

### reqwest::async_impl::client::ClientBuilder::tls_backend_native (function) › Optional

This requires the optional `native-tls` feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_backend_preconfigured (function)

Use a preconfigured TLS backend.

If the passed `Any` argument is not a TLS backend that reqwest
understands, the `ClientBuilder` will error when calling `build`.

### reqwest::async_impl::client::ClientBuilder::tls_backend_preconfigured (function) › Advanced

<div class="warning">

There is no semver stability on the internals of this method. Use at
your own risk.

</div>

This is an advanced option, and can be somewhat brittle. Usage requires
keeping the preconfigured TLS argument version in sync with reqwest,
since version mismatches will result in an "unknown" TLS backend.

If possible, it's preferable to use the methods on `ClientBuilder`
to configure reqwest's TLS.

### reqwest::async_impl::client::ClientBuilder::tls_backend_preconfigured (function) › Optional

This requires one of the optional features `native-tls` or
`rustls(-...)` to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_backend_rustls (function)

Force using the Rustls TLS backend.

Since multiple TLS backends can be optionally enabled, this option will
force the `rustls` backend to be used for this `Client`.

### reqwest::async_impl::client::ClientBuilder::tls_backend_rustls (function) › Optional

This requires the optional `rustls(-...)` feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_certs_merge (function)

Add custom certificate roots.

This can be used to connect to a server that has a self-signed
certificate for example.

This optional attempts to merge with any native or built-in roots.

### reqwest::async_impl::client::ClientBuilder::tls_certs_merge (function) › Errors

If the selected TLS backend or verifier does not support merging
certificates, the builder will return an error.

### reqwest::async_impl::client::ClientBuilder::tls_certs_merge (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_certs_only (function)

Use only the provided certificate roots.

This can be used to connect to a server that has a self-signed
certificate for example.

This option disables any native or built-in roots, and **only** uses
the roots provided to this method.

### reqwest::async_impl::client::ClientBuilder::tls_certs_only (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_crls_only (function)

Add multiple certificate revocation lists.

### reqwest::async_impl::client::ClientBuilder::tls_crls_only (function) › Errors

This only works if also using only provided root certificates. This
cannot work with the native verifier.

If CRLs are added but `tls_certs_only()` is not called, the builder
will return an error.

### reqwest::async_impl::client::ClientBuilder::tls_crls_only (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_certs (function)

Controls the use of certificate validation.

Defaults to `false`.

### reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_certs (function) › Warning

You should think very carefully before using this method. If
invalid certificates are trusted, *any* certificate for *any* site
will be trusted for use. This includes expired certificates. This
introduces significant vulnerabilities, and should only be used
as a last resort.

### reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_certs (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function)

Controls the use of hostname verification.

Defaults to `false`.

### reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function) › Warning

You should think very carefully before you use this method. If
hostname verification is not used, any valid certificate for any
site will be trusted for use from any other. This introduces a
significant vulnerability to man-in-the-middle attacks.

### reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function) › Errors

Depending on the TLS backend and verifier, this might not work with
native certificates, only those added with [`ClientBuilder::tls_certs_only()`].

### reqwest::async_impl::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_version_max (function)

Set the maximum allowed TLS version for connections.

By default, there's no maximum.

On Apple platforms, a value of `tls::Version::TLS_1_3` may cause requests
to fall back to TLS 1.2 if allowed by `tls_version_min`, or fail (with error
-9830) with the `native-tls` backend due to lack of TLS 1.3 support.

### reqwest::async_impl::client::ClientBuilder::tls_version_max (function) › Errors

Cannot set a maximum outside the protocol versions supported by
`rustls` with the `rustls` backend.

### reqwest::async_impl::client::ClientBuilder::tls_version_max (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::async_impl::client::ClientBuilder::tls_version_min (function)

Set the minimum required TLS version for connections.

By default, the TLS backend's own default is used.

On Apple platforms, a value of `tls::Version::TLS_1_3` may cause requests
to fail (with error -9830) with the `native-tls` backend due to lack of
TLS 1.3 support.

### reqwest::async_impl::client::ClientBuilder::tls_version_min (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::async_impl::multipart::Form (struct)

An async multipart/form-data request.

## reqwest::async_impl::multipart::Part (struct)

A field in a multipart form.

## reqwest::async_impl::request::Request (struct)

A request which can be executed with `Client::execute()`.

## reqwest::async_impl::request::RequestBuilder (struct)

A builder to construct the properties of a `Request`.

To construct a `RequestBuilder`, refer to the `Client` documentation.

## reqwest::async_impl::request::RequestBuilder::build (function)

Build a `Request`, which can be inspected, modified and executed with
`Client::execute()`.

## reqwest::async_impl::response::Response (struct)

A Response to a submitted `Request`.

## reqwest::async_impl::response::Response::headers (function)

Get the `Headers` of this `Response`.

## reqwest::async_impl::upgrade::Upgraded (struct)

An upgraded HTTP connection.

## reqwest::basic_auth (function)

Enable HTTP basic authentication.

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let resp = client.delete("http://httpbin.org/delete")
    .basic_auth("admin", Some("good password"))
    .send()?;
# Ok(())
# }
```

## reqwest::basic_auth (function)

Enable HTTP basic authentication.

```rust
# use reqwest::Error;

# async fn run() -> Result<(), Error> {
let client = reqwest::Client::new();
let resp = client.delete("http://httpbin.org/delete")
    .basic_auth("admin", Some("good password"))
    .send()
    .await?;
# Ok(())
# }
```

## reqwest::basic_auth (function)

Set the `Proxy-Authorization` header using Basic auth.

### reqwest::basic_auth (function) › Example

```
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let proxy = reqwest::Proxy::https("http://localhost:1234")?
    .basic_auth("Aladdin", "open sesame");
# Ok(())
# }
# fn main() {}
```

## reqwest::bearer_auth (function)

Enable HTTP bearer authentication.

## reqwest::bearer_auth (function)

Enable HTTP bearer authentication.

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let resp = client.delete("http://httpbin.org/delete")
    .bearer_auth("token")
    .send()?;
# Ok(())
# }
```

## reqwest::blocking::body::Body (struct)

The body of a `Request`.

In most cases, this is not needed directly, as the
[`RequestBuilder.body`][builder] method uses `Into<Body>`, which allows
passing many things (like a string or vector of bytes).

[builder]: ./struct.RequestBuilder.html#method.body

## reqwest::blocking::client::Client (struct)

A `Client` to make Requests with.

The Client has various configuration values to tweak, but the defaults
are set to what is usually the most commonly desired value. To configure a
`Client`, use `Client::builder()`.

The `Client` holds a connection pool internally, so it is advised that
you create one and **reuse** it.

### reqwest::blocking::client::Client (struct) › Examples

```rust
use reqwest::blocking::Client;
#
# fn run() -> Result<(), reqwest::Error> {
let client = Client::new();
let resp = client.get("http://httpbin.org/").send()?;
#   drop(resp);
#   Ok(())
# }

```

## reqwest::blocking::client::ClientBuilder (struct)

A `ClientBuilder` can be used to create a `Client` with  custom configuration.

### reqwest::blocking::client::ClientBuilder (struct) › Example

```
# fn run() -> Result<(), reqwest::Error> {
use std::time::Duration;

let client = reqwest::blocking::Client::builder()
    .timeout(Duration::from_secs(10))
    .build()?;
# Ok(())
# }
```

## reqwest::blocking::client::ClientBuilder::tls_backend_native (function)

Force using the native TLS backend.

Since multiple TLS backends can be optionally enabled, this option will
force the `native-tls` backend to be used for this `Client`.

### reqwest::blocking::client::ClientBuilder::tls_backend_native (function) › Optional

This requires the optional `native-tls` feature to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_backend_preconfigured (function)

Use a preconfigured TLS backend.

If the passed `Any` argument is not a TLS backend that reqwest
understands, the `ClientBuilder` will error when calling `build`.

### reqwest::blocking::client::ClientBuilder::tls_backend_preconfigured (function) › Advanced

This is an advanced option, and can be somewhat brittle. Usage requires
keeping the preconfigured TLS argument version in sync with reqwest,
since version mismatches will result in an "unknown" TLS backend.

If possible, it's preferable to use the methods on `ClientBuilder`
to configure reqwest's TLS.

### reqwest::blocking::client::ClientBuilder::tls_backend_preconfigured (function) › Optional

This requires one of the optional features `native-tls` or
`rustls(-...)` to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_backend_rustls (function)

Force using the Rustls TLS backend.

Since multiple TLS backends can be optionally enabled, this option will
force the `rustls` backend to be used for this `Client`.

### reqwest::blocking::client::ClientBuilder::tls_backend_rustls (function) › Optional

This requires the optional `rustls(-...)` feature to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_certs_merge (function)

Add custom root certificates.

This allows connecting to a server that has a self-signed
certificate for example. This **does not** replace the existing
trusted store.

### reqwest::blocking::client::ClientBuilder::tls_certs_merge (function) › Example

```
# use std::fs::File;
# use std::io::Read;
# fn build_client() -> Result<(), Box<dyn std::error::Error>> {
// read a local binary DER encoded certificate
let der = std::fs::read("my-cert.der")?;

// create a certificate
let cert = reqwest::Certificate::from_der(&der)?;

// get a client builder
let client = reqwest::blocking::Client::builder()
    .tls_certs_merge([cert])
    .build()?;
# drop(client);
# Ok(())
# }
```

### reqwest::blocking::client::ClientBuilder::tls_certs_merge (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_certs_only (function)

Use only the provided certificate roots.

This can be used to connect to a server that has a self-signed
certificate for example.

This option disables any native or built-in roots, and **only** uses
the roots provided to this method.

### reqwest::blocking::client::ClientBuilder::tls_certs_only (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_crls_only (function)

Add multiple certificate revocation lists.

### reqwest::blocking::client::ClientBuilder::tls_crls_only (function) › Errors

This only works if also using only provided root certificates. This
cannot work with the native verifier.

If CRLs are added but `tls_certs_only()` is not called, the builder
will return an error.

### reqwest::blocking::client::ClientBuilder::tls_crls_only (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::blocking::client::ClientBuilder::tls_danger_accept_invalid_certs (function)

Controls the use of certificate validation.

Defaults to `false`.

### reqwest::blocking::client::ClientBuilder::tls_danger_accept_invalid_certs (function) › Warning

You should think very carefully before using this method. If
invalid certificates are trusted, *any* certificate for *any* site
will be trusted for use. This includes expired certificates. This
introduces significant vulnerabilities, and should only be used
as a last resort.

## reqwest::blocking::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function)

Controls the use of hostname verification.

Defaults to `false`.

### reqwest::blocking::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function) › Warning

You should think very carefully before you use this method. If
hostname verification is not used, any valid certificate for any
site will be trusted for use from any other. This introduces a
significant vulnerability to man-in-the-middle attacks.

### reqwest::blocking::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function) › Errors

Depending on the TLS backend and verifier, this might not work with
native certificates, only those added with [`ClientBuilder::tls_certs_only()`].

### reqwest::blocking::client::ClientBuilder::tls_danger_accept_invalid_hostnames (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_version_max (function)

Set the maximum allowed TLS version for connections.

By default, there's no maximum.

### reqwest::blocking::client::ClientBuilder::tls_version_max (function) › Errors

A value of `tls::Version::TLS_1_3` will cause an error with the
`native-tls` backend. This does not mean the version
isn't supported, just that it can't be set as a maximum due to
technical limitations.

### reqwest::blocking::client::ClientBuilder::tls_version_max (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::blocking::client::ClientBuilder::tls_version_min (function)

Set the minimum required TLS version for connections.

By default, the TLS backend's own default is used.

### reqwest::blocking::client::ClientBuilder::tls_version_min (function) › Errors

A value of `tls::Version::TLS_1_3` will cause an error with the
`native-tls` backend. This does not mean the version
isn't supported, just that it can't be set as a minimum due to
technical limitations.

### reqwest::blocking::client::ClientBuilder::tls_version_min (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::blocking::get (function)

Shortcut method to quickly make a *blocking* `GET` request.

**NOTE**: This function creates a new internal `Client` on each call,
and so should not be used if making many requests. Create a
[`Client`](./struct.Client.html) instead.

### reqwest::blocking::get (function) › Examples

```rust
# fn run() -> Result<(), reqwest::Error> {
let body = reqwest::blocking::get("https://www.rust-lang.org")?
    .text()?;
# Ok(())
# }
# fn main() { }
```

### reqwest::blocking::get (function) › Errors

This function fails if:

- the native TLS backend cannot be initialized,
- the supplied `Url` cannot be parsed,
- there was an error while sending request,
- a redirect loop was detected,
- the redirect limit was exhausted, or
- the total download time exceeds 30 seconds.

## reqwest::blocking::multipart::Form (struct)

A multipart/form-data request.

## reqwest::blocking::multipart::Part (struct)

A field in a multipart form.

## reqwest::blocking::request::Request (struct)

A request which can be executed with `Client::execute()`.

## reqwest::blocking::request::RequestBuilder (struct)

A builder to construct the properties of a `Request`.

To construct a `RequestBuilder`, refer to the `Client` documentation.

## reqwest::blocking::request::RequestBuilder::build (function)

Build a `Request`, which can be inspected, modified and executed with
`Client::execute()`.

## reqwest::blocking::response::Response (struct)

A Response to a submitted `Request`.

## reqwest::blocking::response::Response::headers (function)

Get the `Headers` of this `Response`.

### reqwest::blocking::response::Response::headers (function) › Example

Saving an etag when caching a file:

```
use reqwest::blocking::Client;
use reqwest::header::ETAG;

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();

let mut resp = client.get("http://httpbin.org/cache").send()?;
if resp.status().is_success() {
    if let Some(etag) = resp.headers().get(ETAG) {
        std::fs::write("etag", etag.as_bytes());
    }
    let mut file = std::fs::File::create("file")?;
    resp.copy_to(&mut file)?;
}
# Ok(())
# }
```

## reqwest::body (function)

Get the body.

## reqwest::body (function)

Get the body.

## reqwest::body (function)

Set the request body.

## reqwest::body (function)

Set the request body.

### reqwest::body (function) › Examples

Using a string:

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org/post")
    .body("from a &str!")
    .send()?;
# Ok(())
# }
```

Using a `File`:

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let file = std::fs::File::open("from_a_file.txt")?;
let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org/post")
    .body(file)
    .send()?;
# Ok(())
# }
```

Using arbitrary bytes:

```rust
# use std::fs;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
// from bytes!
let bytes: Vec<u8> = vec![1, 10, 100];
let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org/post")
    .body(bytes)
    .send()?;
# Ok(())
# }
```

## reqwest::body_mut (function)

Get a mutable reference to the body.

## reqwest::body_mut (function)

Get a mutable reference to the body.

## reqwest::boundary (function)

Get the boundary that this form will use.

## reqwest::boundary (function)

Get the boundary that this form will use.

## reqwest::brotli (function)

Enable auto brotli decompression by checking the `Content-Encoding` response header.

If auto brotli decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `br`.
  The request body is **not** automatically compressed.
- When receiving a response, if it's headers contain a `Content-Encoding` value that
  equals to `br`, both values `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `brotli` feature is turned on, the default option is enabled.

### reqwest::brotli (function) › Optional

This requires the optional `brotli` feature to be enabled

## reqwest::brotli (function)

Enable auto brotli decompression by checking the `Content-Encoding` response header.

If auto brotli decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `br`.
  The request body is **not** automatically compressed.
- When receiving a response, if its headers contain a `Content-Encoding` value of
  `br`, both `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `brotli` feature is turned on, the default option is enabled.

### reqwest::brotli (function) › Optional

This requires the optional `brotli` feature to be enabled

## reqwest::buffer (function)

Converts streamed requests to their buffered equivalent and
returns a reference to the buffer. If the request is already
buffered, this has no effect.

Be aware that for large requests this method is expensive
and may cause your program to run out of memory.

## reqwest::build (function)

Returns a `Client` that uses this `ClientBuilder` configuration.

### reqwest::build (function) › Errors

This method fails if TLS backend cannot be initialized, or the resolver
cannot load the system configuration.

### reqwest::build (function) › Panics

This method panics if called from within an async runtime. See docs on
[`reqwest::blocking`][crate::blocking] for details.

## reqwest::build (function)

Returns a `Client` that uses this `ClientBuilder` configuration.

### reqwest::build (function) › Errors

This method fails if a TLS backend cannot be initialized, or the resolver
cannot load the system configuration.

## reqwest::build_split (function)

Build a `Request`, which can be inspected, modified and executed with
`Client::execute()`.

This is similar to [`RequestBuilder::build()`], but also returns the
embedded `Client`.

## reqwest::build_split (function)

Build a `Request`, which can be inspected, modified and executed with
`Client::execute()`.

This is similar to [`RequestBuilder::build()`], but also returns the
embedded `Client`.

## reqwest::builder (function)

Creates a `ClientBuilder` to configure a `Client`.

This is the same as `ClientBuilder::new()`.

## reqwest::builder (function)

Creates a `ClientBuilder` to configure a `Client`.

This is the same as `ClientBuilder::new()`.

## reqwest::bytes (function)

Get the full response body as `Bytes`.

### reqwest::bytes (function) › Example

```
# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let bytes = reqwest::get("http://httpbin.org/ip")
    .await?
    .bytes()
    .await?;

println!("bytes: {bytes:?}");
# Ok(())
# }
```

## reqwest::bytes (function)

Get the full response body as `Bytes`.

### reqwest::bytes (function) › Example

```
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let bytes = reqwest::blocking::get("http://httpbin.org/ip")?.bytes()?;

println!("bytes: {bytes:?}");
# Ok(())
# }
```

## reqwest::bytes (function)

Makes a new parameter from arbitrary bytes.

## reqwest::bytes (function)

Makes a new parameter from arbitrary bytes.

## reqwest::bytes_stream (function)

Convert the response into a `Stream` of `Bytes` from the body.

### reqwest::bytes_stream (function) › Example

```
use futures_util::StreamExt;

# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let mut stream = reqwest::get("http://httpbin.org/ip")
    .await?
    .bytes_stream();

while let Some(item) = stream.next().await {
    println!("Chunk: {:?}", item?);
}
# Ok(())
# }
```

### reqwest::bytes_stream (function) › Optional

This requires the optional `stream` feature to be enabled.

## reqwest::chunk (function)

Stream a chunk of the response body.

When the response body has been exhausted, this will return `None`.

### reqwest::chunk (function) › Example

```
# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let mut res = reqwest::get("https://hyper.rs").await?;

while let Some(chunk) = res.chunk().await? {
    println!("Chunk: {chunk:?}");
}
# Ok(())
# }
```

## reqwest::classify (function)

Provide a classifier to determine if a request should be retried.

## reqwest::classify_fn (function)

Provide a classifier to determine if a request should be retried.

### reqwest::classify_fn (function) › Example

```rust
# fn with_builder(builder: reqwest::retry::Builder) -> reqwest::retry::Builder {
builder.classify_fn(|req_rep| {
    match (req_rep.method(), req_rep.status()) {
        (&http::Method::GET, Some(http::StatusCode::SERVICE_UNAVAILABLE)) => {
            req_rep.retryable()
        },
        _ => req_rep.success()
    }
})
# }
```

## reqwest::connect::sealed::Conn (struct)

Note: the `is_proxy` member means *is plain text HTTP proxy*.
This tells hyper whether the URI should be written in
* origin-form (`GET /just/a/path HTTP/1.1`), when `is_proxy == false`, or
* absolute-form (`GET http://foo.bar/and/a/path HTTP/1.1`), otherwise.

## reqwest::connect::uds::UnixSocketProvider (trait)

A provider for Unix Domain Socket paths.

This trait is sealed. This allows us expand the support in the future
by controlling who can implement the trait.

It's available in the docs to see what type may be passed in.

## reqwest::connect_timeout (function)

Set a timeout for only the connect phase of a `Client`.

Default is `None`.

## reqwest::connect_timeout (function)

Set a timeout for only the connect phase of a `Client`.

Default is `None`.

### reqwest::connect_timeout (function) › Note

This **requires** the futures be executed in a tokio runtime with
a tokio timer enabled.

## reqwest::connection_verbose (function)

Set whether connections should emit verbose logs.

Enabling this option will emit [log][] messages at the `TRACE` level
for read and write operations on connections.

[log]: https://crates.io/crates/log

## reqwest::connection_verbose (function)

Set whether connections should emit verbose logs.

Enabling this option will emit [log][] messages at the `TRACE` level
for read and write operations on connections.

[log]: https://crates.io/crates/log

## reqwest::connector_layer (function)

Adds a new Tower [`Layer`](https://docs.rs/tower/latest/tower/trait.Layer.html) to the
base connector [`Service`](https://docs.rs/tower/latest/tower/trait.Service.html) which
is responsible for connection establishment.

Each subsequent invocation of this function will wrap previous layers.

Example usage:
```
use std::time::Duration;

let client = reqwest::blocking::Client::builder()
                     // resolved to outermost layer, meaning while we are waiting on concurrency limit
                     .connect_timeout(Duration::from_millis(200))
                     // underneath the concurrency check, so only after concurrency limit lets us through
                     .connector_layer(tower::timeout::TimeoutLayer::new(Duration::from_millis(50)))
                     .connector_layer(tower::limit::concurrency::ConcurrencyLimitLayer::new(2))
                     .build()
                     .unwrap();
```

## reqwest::connector_layer (function)

Adds a new Tower [`Layer`](https://docs.rs/tower/latest/tower/trait.Layer.html) to the
base connector [`Service`](https://docs.rs/tower/latest/tower/trait.Service.html) which
is responsible for connection establishment.

Each subsequent invocation of this function will wrap previous layers.

If configured, the `connect_timeout` will be the outermost layer.

Example usage:
```
use std::time::Duration;

# #[cfg(not(feature = "rustls-no-provider"))]
let client = reqwest::Client::builder()
                     // resolved to outermost layer, meaning while we are waiting on concurrency limit
                     .connect_timeout(Duration::from_millis(200))
                     // underneath the concurrency check, so only after concurrency limit lets us through
                     .connector_layer(tower::timeout::TimeoutLayer::new(Duration::from_millis(50)))
                     .connector_layer(tower::limit::concurrency::ConcurrencyLimitLayer::new(2))
                     .build()
                     .unwrap();
```

## reqwest::content_length (function)

Get the content length of the response, if it is known.


This value does not directly represents the value of the `Content-Length`
header, but rather the size of the response's body. To read the header's
value, please use the [`Response::headers`] method instead.

Reasons it may not be known:

- The response does not include a body (e.g. it responds to a `HEAD`
  request).
- The response is gzipped and automatically decoded (thus changing the
  actual decoded length).

## reqwest::content_length (function)

Get the content length of the response, if it is known.

This value does not directly represents the value of the `Content-Length`
header, but rather the size of the response's body. To read the header's
value, please use the [`Response::headers`] method instead.

Reasons it may not be known:

- The response does not include a body (e.g. it responds to a `HEAD`
  request).
- The response is gzipped and automatically decoded (thus changing the
  actual decoded length).

## reqwest::cookie::Cookie (struct)

A single HTTP cookie.

## reqwest::cookie::CookieStore (trait)

Actions for a persistent cookie store providing session support.

## reqwest::cookie::Jar (struct)

A good default `CookieStore` implementation.

This is the implementation used when simply calling `cookie_store(true)`.
This type is exposed to allow creating one and filling it with some
existing cookies more easily, before creating a `Client`.

For more advanced scenarios, such as needing to serialize the store or
manipulate it between requests, you may refer to the
[reqwest_cookie_store crate](https://crates.io/crates/reqwest_cookie_store).

## reqwest::cookie_provider (function)

Set the persistent cookie store for the client.

Cookies received in responses will be passed to this store, and
additional requests will query this store for cookies.

By default, no cookie store is used.

### reqwest::cookie_provider (function) › Optional

This requires the optional `cookies` feature to be enabled.

## reqwest::cookie_store (function)

Enable a persistent cookie store for the client.

Cookies received in responses will be preserved and included in
additional requests.

By default, no cookie store is used.

### reqwest::cookie_store (function) › Optional

This requires the optional `cookies` feature to be enabled.

## reqwest::cookies (function)

Get any Cookie values in the store for `url`

## reqwest::cookies (function)

Retrieve the cookies contained in the response.

Note that invalid 'Set-Cookie' headers will be ignored.

### reqwest::cookies (function) › Optional

This requires the optional `cookies` feature to be enabled.

## reqwest::cookies (function)

Retrieve the cookies contained in the response.

Note that invalid 'Set-Cookie' headers will be ignored.

### reqwest::cookies (function) › Optional

This requires the optional `cookies` feature to be enabled.

## reqwest::copy_to (function)

Copy the response body into a writer.

This function internally uses [`std::io::copy`] and hence will continuously read data from
the body and then write it into writer in a streaming fashion until EOF is met.

On success, the total number of bytes that were copied to `writer` is returned.

[`std::io::copy`]: https://doc.rust-lang.org/std/io/fn.copy.html

### reqwest::copy_to (function) › Example

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let mut resp = reqwest::blocking::get("http://httpbin.org/range/5")?;
let mut buf: Vec<u8> = vec![];
resp.copy_to(&mut buf)?;
assert_eq!(b"abcde", buf.as_slice());
# Ok(())
# }
```

## reqwest::custom (function)

Create a custom `Policy` using the passed function.

### reqwest::custom (function) › Note

The default `Policy` handles a maximum loop
chain, but the custom variant does not do that for you automatically.
The custom policy should have some way of handling those.

Information on the next request and previous requests can be found
on the [`Attempt`] argument passed to the closure.

Actions can be conveniently created from methods on the
[`Attempt`].

### reqwest::custom (function) › Example

```rust
# use reqwest::{Error, redirect};
#
# fn run() -> Result<(), Error> {
let custom = redirect::Policy::custom(|attempt| {
    if attempt.previous().len() > 5 {
        attempt.error("too many redirects")
    } else if attempt.url().host_str() == Some("example.domain") {
        // prevent redirects to 'example.domain'
        attempt.stop()
    } else {
        attempt.follow()
    }
});
let client = reqwest::Client::builder()
    .redirect(custom)
    .build()?;
# Ok(())
# }
```

[`Attempt`]: struct.Attempt.html

## reqwest::custom (function)

Provide a custom function to determine what traffic to proxy to where.

### reqwest::custom (function) › Example

```
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let target = reqwest::Url::parse("https://my.prox")?;
let client = reqwest::Client::builder()
    .proxy(reqwest::Proxy::custom(move |url| {
        if url.host_str() == Some("hyper.rs") {
            Some(target.clone())
        } else {
            None
        }
    }))
    .build()?;
# Ok(())
# }
# fn main() {}
```

## reqwest::custom_http_auth (function)

Set the `Proxy-Authorization` header to a specified value.

### reqwest::custom_http_auth (function) › Example

```
# extern crate reqwest;
# use reqwest::header::*;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let proxy = reqwest::Proxy::https("http://localhost:1234")?
    .custom_http_auth(HeaderValue::from_static("justletmeinalreadyplease"));
# Ok(())
# }
# fn main() {}
```

## reqwest::danger_accept_invalid_certs (function)

Deprecated: use [`ClientBuilder::tls_danger_accept_invalid_certs()`] instead.

## reqwest::danger_accept_invalid_certs (function)

Deprecated: use [`ClientBuilder::tls_danger_accept_invalid_certs()`] instead.

## reqwest::danger_accept_invalid_hostnames (function)

Deprecated: use [`ClientBuilder::tls_danger_accept_invalid_hostnames()`] instead.

## reqwest::danger_accept_invalid_hostnames (function)

Deprecated: use [`ClientBuilder::tls_danger_accept_invalid_hostnames()`] instead.

## reqwest::default_headers (function)

Sets the default headers for every request.

### reqwest::default_headers (function) › Example

```rust
use reqwest::header;
# async fn doc() -> Result<(), reqwest::Error> {
let mut headers = header::HeaderMap::new();
headers.insert("X-MY-HEADER", header::HeaderValue::from_static("value"));

// Consider marking security-sensitive headers with `set_sensitive`.
let mut auth_value = header::HeaderValue::from_static("secret");
auth_value.set_sensitive(true);
headers.insert(header::AUTHORIZATION, auth_value);

// get a client builder
let client = reqwest::Client::builder()
    .default_headers(headers)
    .build()?;
let res = client.get("https://www.rust-lang.org").send().await?;
# Ok(())
# }
```

## reqwest::default_headers (function)

Sets the default headers for every request.

### reqwest::default_headers (function) › Example

```rust
use reqwest::header;
# fn build_client() -> Result<(), reqwest::Error> {
let mut headers = header::HeaderMap::new();
headers.insert("X-MY-HEADER", header::HeaderValue::from_static("value"));
headers.insert(header::AUTHORIZATION, header::HeaderValue::from_static("secret"));

// Consider marking security-sensitive headers with `set_sensitive`.
let mut auth_value = header::HeaderValue::from_static("secret");
auth_value.set_sensitive(true);
headers.insert(header::AUTHORIZATION, auth_value);

// get a client builder
let client = reqwest::blocking::Client::builder()
    .default_headers(headers)
    .build()?;
let res = client.get("https://www.rust-lang.org").send()?;
# Ok(())
# }
```

## reqwest::deflate (function)

Enable auto deflate decompression by checking the `Content-Encoding` response header.

If auto deflate decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `deflate`.
  The request body is **not** automatically compressed.
- When receiving a response, if it's headers contain a `Content-Encoding` value that
  equals to `deflate`, both values `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `deflate` feature is turned on, the default option is enabled.

### reqwest::deflate (function) › Optional

This requires the optional `deflate` feature to be enabled

## reqwest::deflate (function)

Enable auto deflate decompression by checking the `Content-Encoding` response header.

If auto deflate decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `deflate`.
  The request body is **not** automatically compressed.
- When receiving a response, if it's headers contain a `Content-Encoding` value that
  equals to `deflate`, both values `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `deflate` feature is turned on, the default option is enabled.

### reqwest::deflate (function) › Optional

This requires the optional `deflate` feature to be enabled

## reqwest::delete (function)

Convenience method to make a `DELETE` request to a URL.

### reqwest::delete (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::delete (function)

Convenience method to make a `DELETE` request to a URL.

### reqwest::delete (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::dns::resolve::Addrs (type_alias)

Alias for an `Iterator` trait object over `SocketAddr`.

## reqwest::dns::resolve::IntoResolve (trait)

A more general trait implemented for types implementing `Resolve`.

Unnameable, only exported to aid seeing what implements this.

## reqwest::dns::resolve::Name (struct)

A name that must be resolved to addresses.

## reqwest::dns::resolve::Resolve (trait)

Trait for customizing DNS resolution in reqwest.

## reqwest::dns::resolve::Resolving (type_alias)

Alias for the `Future` type returned by a DNS resolver.

## reqwest::dns_resolver (function)

Override the DNS resolver implementation.

Overrides for specific names passed to `resolve` and `resolve_to_addrs` will
still be applied on top of this resolver.

## reqwest::dns_resolver (function)

Override the DNS resolver implementation.

Pass an `Arc` wrapping a trait object implementing `Resolve`.
Overrides for specific names passed to `resolve` and `resolve_to_addrs` will
still be applied on top of this resolver.

## reqwest::domain (function)

Returns the domain directive of the cookie, if set.

## reqwest::error (function)

Access the error, if a response was not received.

## reqwest::error (function)

Returns an action failing the redirect with an error.

The `Error` will be returned for the result of the sent request.

## reqwest::error::Error (struct)

The Errors that may occur when processing a `Request`.

Note: Errors may include the full URL used to make the `Request`. If the URL
contains sensitive information (e.g. an API key as a query parameter), be
sure to remove it ([`without_url`](Error::without_url))

## reqwest::error::Error::without_url (function)

Strip the related url from this error (if, for example, it contains
sensitive information)

## reqwest::error::Result (type_alias)

A `Result` alias where the `Err` case is `reqwest::Error`.

## reqwest::error_for_status (function)

Turn a response into an error if the server returned an error.

### reqwest::error_for_status (function) › Example

```
# use reqwest::Response;
fn on_response(res: Response) {
    match res.error_for_status() {
        Ok(_res) => (),
        Err(err) => {
            // asserting a 400 as an example
            // it could be any status between 400...599
            assert_eq!(
                err.status(),
                Some(reqwest::StatusCode::BAD_REQUEST)
            );
        }
    }
}
# fn main() {}
```

## reqwest::error_for_status (function)

Turn a response into an error if the server returned an error.

### reqwest::error_for_status (function) › Example

```rust,no_run
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let res = reqwest::blocking::get("http://httpbin.org/status/400")?
    .error_for_status();
if let Err(err) = res {
    assert_eq!(err.status(), Some(reqwest::StatusCode::BAD_REQUEST));
}
# Ok(())
# }
# fn main() {}
```

## reqwest::error_for_status_ref (function)

Turn a reference to a response into an error if the server returned an error.

### reqwest::error_for_status_ref (function) › Example

```
# use reqwest::Response;
fn on_response(res: &Response) {
    match res.error_for_status_ref() {
        Ok(_res) => (),
        Err(err) => {
            // asserting a 400 as an example
            // it could be any status between 400...599
            assert_eq!(
                err.status(),
                Some(reqwest::StatusCode::BAD_REQUEST)
            );
        }
    }
}
# fn main() {}
```

## reqwest::error_for_status_ref (function)

Turn a reference to a response into an error if the server returned an error.

### reqwest::error_for_status_ref (function) › Example

```rust,no_run
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let res = reqwest::blocking::get("http://httpbin.org/status/400")?;
let res = res.error_for_status_ref();
if let Err(err) = res {
    assert_eq!(err.status(), Some(reqwest::StatusCode::BAD_REQUEST));
}
# Ok(())
# }
# fn main() {}
```

## reqwest::execute (function)

Executes a `Request`.

A `Request` can be built manually with `Request::new()` or obtained
from a RequestBuilder with `RequestBuilder::build()`.

You should prefer to use the `RequestBuilder` and
`RequestBuilder::send()`.

### reqwest::execute (function) › Errors

This method fails if there was an error while sending request,
or redirect limit was exhausted.

## reqwest::execute (function)

Executes a `Request`.

A `Request` can be built manually with `Request::new()` or obtained
from a RequestBuilder with `RequestBuilder::build()`.

You should prefer to use the `RequestBuilder` and
`RequestBuilder::send()`.

### reqwest::execute (function) › Errors

This method fails if there was an error while sending request,
redirect loop was detected or redirect limit was exhausted.

## reqwest::expires (function)

The cookie expiration time.

## reqwest::extensions (function)

Returns a reference to the associated extensions.

## reqwest::extensions (function)

Returns a reference to the associated extensions.

## reqwest::extensions_mut (function)

Returns a mutable reference to the associated extensions.

## reqwest::extensions_mut (function)

Returns a mutable reference to the associated extensions.

## reqwest::file (function)

Adds a file field.

The path will be used to try to guess the filename and mime.

### reqwest::file (function) › Examples

```no_run
# async fn run() -> std::io::Result<()> {
let form = reqwest::multipart::Form::new()
    .file("key", "/path/to/file").await?;
# Ok(())
# }
```

### reqwest::file (function) › Errors

Errors when the file cannot be opened.

## reqwest::file (function)

Adds a file field.

The path will be used to try to guess the filename and mime.

### reqwest::file (function) › Examples

```no_run
# fn run() -> std::io::Result<()> {
let form = reqwest::blocking::multipart::Form::new()
    .file("key", "/path/to/file")?;
# Ok(())
# }
```

### reqwest::file (function) › Errors

Errors when the file cannot be opened.

## reqwest::file (function)

Makes a file parameter.

### reqwest::file (function) › Errors

Errors when the file cannot be opened.

## reqwest::file (function)

Makes a file parameter.

### reqwest::file (function) › Errors

Errors when the file cannot be opened.

## reqwest::file_name (function)

Sets the filename, builder style.

## reqwest::file_name (function)

Sets the filename, builder style.

## reqwest::follow (function)

Returns an action meaning reqwest should follow the next URL.

## reqwest::form (function)

Send a form body.

Sets the body to the url encoded serialization of the passed value,
and also sets the `Content-Type: application/x-www-form-urlencoded`
header.

```rust
# use reqwest::Error;
# use std::collections::HashMap;
#
# async fn run() -> Result<(), Error> {
let mut params = HashMap::new();
params.insert("lang", "rust");

let client = reqwest::Client::new();
let res = client.post("http://httpbin.org")
    .form(&params)
    .send()
    .await?;
# Ok(())
# }
```

### reqwest::form (function) › Optional

This requires the optional `form` feature to be enabled.

### reqwest::form (function) › Errors

This method fails if the passed value cannot be serialized into
url encoded format

## reqwest::form (function)

Send a form body.

Sets the body to the url encoded serialization of the passed value,
and also sets the `Content-Type: application/x-www-form-urlencoded`
header.

```rust
# use reqwest::Error;
# use std::collections::HashMap;
#
# fn run() -> Result<(), Error> {
let mut params = HashMap::new();
params.insert("lang", "rust");

let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org")
    .form(&params)
    .send()?;
# Ok(())
# }
```

### reqwest::form (function) › Optional

This requires the optional `form` feature to be enabled.

### reqwest::form (function) › Errors

This method fails if the passed value cannot be serialized into
url encoded format

## reqwest::from_der (function)

Create a `Certificate` from a binary DER encoded certificate

### reqwest::from_der (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn cert() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my_cert.der")?
    .read_to_end(&mut buf)?;
let cert = reqwest::Certificate::from_der(&buf)?;
# drop(cert);
# Ok(())
# }
```

## reqwest::from_env (function)

Returns a new no-proxy configuration based on environment variables (or `None` if no variables are set)
see [self::NoProxy::from_string()] for the string format

## reqwest::from_parts (function)

Assemble a builder starting from an existing `Client` and a `Request`.

## reqwest::from_parts (function)

Assemble a builder starting from an existing `Client` and a `Request`.

## reqwest::from_pem (function)

Create a `Certificate` from a PEM encoded certificate

### reqwest::from_pem (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn cert() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my_cert.pem")?
    .read_to_end(&mut buf)?;
let cert = reqwest::Certificate::from_pem(&buf)?;
# drop(cert);
# Ok(())
# }
```

## reqwest::from_pem (function)

Parses PEM encoded private key and certificate.

The input should contain a PEM encoded private key
and at least one PEM encoded certificate.

Note: The private key must be in RSA, SEC1 Elliptic Curve or PKCS#8 format.

### reqwest::from_pem (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn pem() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my-ident.pem")?
    .read_to_end(&mut buf)?;
let id = reqwest::Identity::from_pem(&buf)?;
# drop(id);
# Ok(())
# }
```

### reqwest::from_pem (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::from_pem (function)

Parses a PEM encoded CRL.

### reqwest::from_pem (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn crl() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my_crl.pem")?
    .read_to_end(&mut buf)?;
let crl = reqwest::tls::CertificateRevocationList::from_pem(&buf)?;
# drop(crl);
# Ok(())
# }
```

### reqwest::from_pem (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::from_pem_bundle (function)

Create a collection of `Certificate`s from a PEM encoded certificate bundle.
Example byte sources may be `.crt`, `.cer` or `.pem` files.

### reqwest::from_pem_bundle (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn cert() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("ca-bundle.crt")?
    .read_to_end(&mut buf)?;
let certs = reqwest::Certificate::from_pem_bundle(&buf)?;
# drop(certs);
# Ok(())
# }
```

## reqwest::from_pem_bundle (function)

Creates a collection of `CertificateRevocationList`s from a PEM encoded CRL bundle.
Example byte sources may be `.crl` or `.pem` files.

### reqwest::from_pem_bundle (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn crls() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("crl-bundle.crl")?
    .read_to_end(&mut buf)?;
let crls = reqwest::tls::CertificateRevocationList::from_pem_bundle(&buf)?;
# drop(crls);
# Ok(())
# }
```

### reqwest::from_pem_bundle (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::from_pkcs12_der (function)

Parses a DER-formatted PKCS #12 archive, using the specified password to decrypt the key.

The archive should contain a leaf certificate and its private key, as well any intermediate
certificates that allow clients to build a chain to a trusted root.
The chain certificates should be in order from the leaf certificate towards the root.

PKCS #12 archives typically have the file extension `.p12` or `.pfx`, and can be created
with the OpenSSL `pkcs12` tool:

```bash
openssl pkcs12 -export -out identity.pfx -inkey key.pem -in cert.pem -certfile chain_certs.pem
```

### reqwest::from_pkcs12_der (function) › Examples

```
# use std::fs::File;
# use std::io::Read;
# fn pkcs12() -> Result<(), Box<dyn std::error::Error>> {
let mut buf = Vec::new();
File::open("my-ident.pfx")?
    .read_to_end(&mut buf)?;
let pkcs12 = reqwest::Identity::from_pkcs12_der(&buf, "my-privkey-password")?;
# drop(pkcs12);
# Ok(())
# }
```

### reqwest::from_pkcs12_der (function) › Optional

This requires the `native-tls` Cargo feature enabled.

## reqwest::from_pkcs8_pem (function)

Parses a chain of PEM encoded X509 certificates, with the leaf certificate first.
`key` is a PEM encoded PKCS #8 formatted private key for the leaf certificate.

The certificate chain should contain any intermediate certificates that should be sent to
clients to allow them to build a chain to a trusted root.

A certificate chain here means a series of PEM encoded certificates concatenated together.

### reqwest::from_pkcs8_pem (function) › Examples

```
# use std::fs;
# fn pkcs8() -> Result<(), Box<dyn std::error::Error>> {
let cert = fs::read("client.pem")?;
let key = fs::read("key.pem")?;
let pkcs8 = reqwest::Identity::from_pkcs8_pem(&cert, &key)?;
# drop(pkcs8);
# Ok(())
# }
```

### reqwest::from_pkcs8_pem (function) › Optional

This requires the `native-tls` Cargo feature enabled.

## reqwest::get (function)

Convenience method to make a `GET` request to a URL.

### reqwest::get (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::get (function)

Convenience method to make a `GET` request to a URL.

### reqwest::get (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::get (function)

Shortcut method to quickly make a `GET` request.

See also the methods on the [`reqwest::Response`](./struct.Response.html)
type.

**NOTE**: This function creates a new internal `Client` on each call,
and so should not be used if making many requests. Create a
[`Client`](./struct.Client.html) instead.

### reqwest::get (function) › Examples

```rust
# async fn run() -> Result<(), reqwest::Error> {
let body = reqwest::get("https://www.rust-lang.org").await?
    .text().await?;
# Ok(())
# }
```

### reqwest::get (function) › Errors

This function fails if:

- native TLS backend cannot be initialized
- supplied `Url` cannot be parsed
- there was an error while sending request
- redirect limit was exhausted

## reqwest::gzip (function)

Enable auto gzip decompression by checking the `Content-Encoding` response header.

If auto gzip decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `gzip`.
  The request body is **not** automatically compressed.
- When receiving a response, if it's headers contain a `Content-Encoding` value that
  equals to `gzip`, both values `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `gzip` feature is turned on, the default option is enabled.

### reqwest::gzip (function) › Optional

This requires the optional `gzip` feature to be enabled

## reqwest::gzip (function)

Enable auto gzip decompression by checking the `Content-Encoding` response header.

If auto gzip decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `gzip`.
  The request body is **not** automatically compressed.
- When receiving a response, if its headers contain a `Content-Encoding` value of
  `gzip`, both `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `gzip` feature is turned on, the default option is enabled.

### reqwest::gzip (function) › Optional

This requires the optional `gzip` feature to be enabled

## reqwest::head (function)

Convenience method to make a `HEAD` request to a URL.

### reqwest::head (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::head (function)

Convenience method to make a `HEAD` request to a URL.

### reqwest::head (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::header (function)

Add a `Header` to this Request.

## reqwest::header (function)

Add a `Header` to this Request.

```rust
use reqwest::header::USER_AGENT;

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let res = client.get("https://www.rust-lang.org")
    .header(USER_AGENT, "foo")
    .send()?;
# Ok(())
# }
```

## reqwest::headers (function)

Add a set of Headers to the existing ones on this Request.

The headers will be merged in to any already set.

## reqwest::headers (function)

Add a set of Headers to the existing ones on this Request.

The headers will be merged in to any already set.

```rust
use reqwest::header::{HeaderMap, HeaderValue, USER_AGENT, CONTENT_TYPE};
# use std::fs;

fn construct_headers() -> HeaderMap {
    let mut headers = HeaderMap::new();
    headers.insert(USER_AGENT, HeaderValue::from_static("reqwest"));
    headers.insert(CONTENT_TYPE, HeaderValue::from_static("image/png"));
    headers
}

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let file = fs::File::open("much_beauty.png")?;
let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org/post")
    .headers(construct_headers())
    .body(file)
    .send()?;
# Ok(())
# }
```

## reqwest::headers (function)

Adds a Custom Headers to Proxy
Adds custom headers to this Proxy

### reqwest::headers (function) › Example
```
# extern crate reqwest;
# use reqwest::header::*;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let mut headers = HeaderMap::new();
headers.insert(USER_AGENT, "reqwest".parse().unwrap());
let proxy = reqwest::Proxy::https("http://localhost:1234")?
    .headers(headers);
# Ok(())
# }
# fn main() {}
```

## reqwest::headers (function)

Get the headers.

## reqwest::headers (function)

Get the headers.

## reqwest::headers (function)

Sets custom headers for the part.

## reqwest::headers (function)

Sets custom headers for the part.

## reqwest::headers_mut (function)

Get a mutable reference to the `Headers` of this `Response`.

## reqwest::headers_mut (function)

Get a mutable reference to the `Headers` of this `Response`.

## reqwest::headers_mut (function)

Get a mutable reference to the headers.

## reqwest::headers_mut (function)

Get a mutable reference to the headers.

## reqwest::hickory_dns (function)

Enables the [hickory-dns](hickory_resolver) async resolver instead of a default threadpool
using `getaddrinfo`.

If the `hickory-dns` feature is turned on, the default option is enabled.

### reqwest::hickory_dns (function) › Optional

This requires the optional `hickory-dns` feature to be enabled

### reqwest::hickory_dns (function) › Warning

The hickory resolver does not work exactly the same, or on all the platforms
that the default resolver does

## reqwest::hickory_dns (function)

Enables the [hickory-dns](hickory_resolver) async resolver instead of a default threadpool using `getaddrinfo`.

If the `hickory-dns` feature is turned on, the default option is enabled.

### reqwest::hickory_dns (function) › Optional

This requires the optional `hickory-dns` feature to be enabled

## reqwest::http (function)

Proxy all HTTP traffic to the passed URL.

### reqwest::http (function) › Example

```
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
    .proxy(reqwest::Proxy::http("https://my.prox")?)
    .build()?;
# Ok(())
# }
# fn main() {}
```

## reqwest::http09_responses (function)

Allow HTTP/0.9 responses

## reqwest::http09_responses (function)

Allow HTTP/0.9 responses

## reqwest::http1_allow_obsolete_multiline_headers_in_responses (function)

Set whether HTTP/1 connections will accept obsolete line folding for
header values.

Newline codepoints (`\r` and `\n`) will be transformed to spaces when
parsing.

## reqwest::http1_allow_obsolete_multiline_headers_in_responses (function)

Set whether HTTP/1 connections will accept obsolete line folding for
header values.

Newline codepoints (`\r` and `\n`) will be transformed to spaces when
parsing.

## reqwest::http1_allow_spaces_after_header_name_in_responses (function)

Set whether HTTP/1 connections will accept spaces between header
names and the colon that follow them in responses.

Newline codepoints (\r and \n) will be transformed to spaces when
parsing.

## reqwest::http1_allow_spaces_after_header_name_in_responses (function)

Set whether HTTP/1 connections will accept spaces between header
names and the colon that follow them in responses.

Newline codepoints (`\r` and `\n`) will be transformed to spaces when
parsing.

## reqwest::http1_ignore_invalid_headers_in_responses (function)

Sets whether invalid header lines should be silently ignored in HTTP/1 responses.

## reqwest::http1_ignore_invalid_headers_in_responses (function)

Sets whether invalid header lines should be silently ignored in HTTP/1 responses.

## reqwest::http1_max_headers (function)

Set the maximum number of headers accepted in an HTTP/1 response.

When a response contains more headers than this value, it is rejected
with a parse error and the request fails.

Default is 100.

## reqwest::http1_max_headers (function)

Set the maximum number of headers accepted in an HTTP/1 response.

When a response contains more headers than this value, it is rejected
with a parse error and the request fails.

Default is 100.

## reqwest::http1_only (function)

Only use HTTP/1.

## reqwest::http1_only (function)

Only use HTTP/1.

## reqwest::http1_title_case_headers (function)

Send headers as title case instead of lowercase.

## reqwest::http1_title_case_headers (function)

Send headers as title case instead of lowercase.

## reqwest::http2_adaptive_window (function)

Sets whether to use an adaptive flow control.

Enabling this will override the limits set in `http2_initial_stream_window_size` and
`http2_initial_connection_window_size`.

## reqwest::http2_adaptive_window (function)

Sets whether to use an adaptive flow control.

Enabling this will override the limits set in `http2_initial_stream_window_size` and
`http2_initial_connection_window_size`.

## reqwest::http2_initial_connection_window_size (function)

Sets the max connection-level flow control for HTTP2

Default may change internally to optimize for common uses.

## reqwest::http2_initial_connection_window_size (function)

Sets the max connection-level flow control for HTTP2

Default may change internally to optimize for common uses.

## reqwest::http2_initial_stream_window_size (function)

Sets the `SETTINGS_INITIAL_WINDOW_SIZE` option for HTTP2 stream-level flow control.

Default may change internally to optimize for common uses.

## reqwest::http2_initial_stream_window_size (function)

Sets the `SETTINGS_INITIAL_WINDOW_SIZE` option for HTTP2 stream-level flow control.

Default may change internally to optimize for common uses.

## reqwest::http2_keep_alive_interval (function)

Sets an interval for HTTP2 Ping frames should be sent to keep a connection alive.

Pass `None` to disable HTTP2 keep-alive.
Default is currently disabled.

## reqwest::http2_keep_alive_interval (function)

Sets an interval for HTTP2 Ping frames should be sent to keep a connection alive.

Pass `None` to disable HTTP2 keep-alive.
Default is currently disabled.

## reqwest::http2_keep_alive_timeout (function)

Sets a timeout for receiving an acknowledgement of the keep-alive ping.

If the ping is not acknowledged within the timeout, the connection will be closed.
Does nothing if `http2_keep_alive_interval` is disabled.
Default is currently disabled.

## reqwest::http2_keep_alive_timeout (function)

Sets a timeout for receiving an acknowledgement of the keep-alive ping.

If the ping is not acknowledged within the timeout, the connection will be closed.
Does nothing if `http2_keep_alive_interval` is disabled.
Default is currently disabled.

## reqwest::http2_keep_alive_while_idle (function)

Sets whether HTTP2 keep-alive should apply while the connection is idle.

If disabled, keep-alive pings are only sent while there are open request/responses streams.
If enabled, pings are also sent when no streams are active.
Does nothing if `http2_keep_alive_interval` is disabled.
Default is `false`.

## reqwest::http2_keep_alive_while_idle (function)

Sets whether HTTP2 keep-alive should apply while the connection is idle.

If disabled, keep-alive pings are only sent while there are open request/responses streams.
If enabled, pings are also sent when no streams are active.
Does nothing if `http2_keep_alive_interval` is disabled.
Default is `false`.

## reqwest::http2_max_frame_size (function)

Sets the maximum frame size to use for HTTP2.

Default is currently 16,384 but may change internally to optimize for common uses.

## reqwest::http2_max_frame_size (function)

Sets the maximum frame size to use for HTTP2.

Default is currently 16,384 but may change internally to optimize for common uses.

## reqwest::http2_max_header_list_size (function)

Sets the maximum size of received header frames for HTTP2.

Default is currently 16KB, but can change.

## reqwest::http2_max_header_list_size (function)

Sets the maximum size of received header frames for HTTP2.

Default is currently 16KB, but can change.

## reqwest::http2_prior_knowledge (function)

Only use HTTP/2.

## reqwest::http2_prior_knowledge (function)

Only use HTTP/2.

## reqwest::http3_congestion_bbr (function)

Override the default congestion control algorithm to use [BBR]

The current default congestion control algorithm is [CUBIC]. This method overrides the
default.

[BBR]: https://datatracker.ietf.org/doc/html/draft-ietf-ccwg-bbr
[CUBIC]: https://datatracker.ietf.org/doc/html/rfc8312

## reqwest::http3_congestion_bbr (function)

Override the default congestion control algorithm to use [BBR]

The current default congestion control algorithm is [CUBIC]. This method overrides the
default.

[BBR]: https://datatracker.ietf.org/doc/html/draft-ietf-ccwg-bbr
[CUBIC]: https://datatracker.ietf.org/doc/html/rfc8312

## reqwest::http3_conn_receive_window (function)

Maximum number of bytes the peer may transmit across all streams of a connection before
becoming blocked.

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

### reqwest::http3_conn_receive_window (function) › Panics

Panics if the value is over 2^62.

## reqwest::http3_conn_receive_window (function)

Maximum number of bytes the peer may transmit across all streams of a connection before
becoming blocked.

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

### reqwest::http3_conn_receive_window (function) › Panics

Panics if the value is over 2^62.

## reqwest::http3_max_field_section_size (function)

Set the maximum HTTP/3 header size this client is willing to accept.

See [header size constraints] section of the specification for details.

[header size constraints]: https://www.rfc-editor.org/rfc/rfc9114.html#name-header-size-constraints

Please see docs in [`Builder`] in [`h3`].

[`Builder`]: https://docs.rs/h3/latest/h3/client/struct.Builder.html#method.max_field_section_size

## reqwest::http3_max_field_section_size (function)

Set the maximum HTTP/3 header size this client is willing to accept.

See [header size constraints] section of the specification for details.

[header size constraints]: https://www.rfc-editor.org/rfc/rfc9114.html#name-header-size-constraints

Please see docs in [`Builder`] in [`h3`].

[`Builder`]: https://docs.rs/h3/latest/h3/client/struct.Builder.html#method.max_field_section_size

## reqwest::http3_max_idle_timeout (function)

Maximum duration of inactivity to accept before timing out the QUIC connection.

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

## reqwest::http3_max_idle_timeout (function)

Maximum duration of inactivity to accept before timing out the QUIC connection.

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

## reqwest::http3_prior_knowledge (function)

Only use HTTP/3.

## reqwest::http3_prior_knowledge (function)

This requires the optional `http3` feature to be
enabled.

## reqwest::http3_send_grease (function)

Enable whether to send HTTP/3 protocol grease on the connections.

HTTP/3 uses the concept of "grease"

to prevent potential interoperability issues in the future.
In HTTP/3, the concept of grease is used to ensure that the protocol can evolve
and accommodate future changes without breaking existing implementations.

Please see docs in [`Builder`] in [`h3`].

[`Builder`]: https://docs.rs/h3/latest/h3/client/struct.Builder.html#method.send_grease

## reqwest::http3_send_grease (function)

Enable whether to send HTTP/3 protocol grease on the connections.

HTTP/3 uses the concept of "grease"

to prevent potential interoperability issues in the future.
In HTTP/3, the concept of grease is used to ensure that the protocol can evolve
and accommodate future changes without breaking existing implementations.

Please see docs in [`Builder`] in [`h3`].

[`Builder`]: https://docs.rs/h3/latest/h3/client/struct.Builder.html#method.send_grease

## reqwest::http3_send_window (function)

Maximum number of bytes to transmit to a peer without acknowledgment

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

## reqwest::http3_send_window (function)

Maximum number of bytes to transmit to a peer without acknowledgment

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

## reqwest::http3_stream_receive_window (function)

Maximum number of bytes the peer may transmit without acknowledgement on any one stream
before becoming blocked.

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

### reqwest::http3_stream_receive_window (function) › Panics

Panics if the value is over 2^62.

## reqwest::http3_stream_receive_window (function)

Maximum number of bytes the peer may transmit without acknowledgement on any one stream
before becoming blocked.

Please see docs in [`TransportConfig`] in [`quinn`].

[`TransportConfig`]: https://docs.rs/quinn/latest/quinn/struct.TransportConfig.html

### reqwest::http3_stream_receive_window (function) › Panics

Panics if the value is over 2^62.

## reqwest::http_only (function)

Returns true if the 'HttpOnly' directive is enabled.

## reqwest::https (function)

Proxy all HTTPS traffic to the passed URL.

### reqwest::https (function) › Example

```
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
    .proxy(reqwest::Proxy::https("https://example.prox:4545")?)
    .build()?;
# Ok(())
# }
# fn main() {}
```

## reqwest::https_only (function)

Restrict the Client to be used with HTTPS only requests.

Defaults to false.

## reqwest::https_only (function)

Restrict the Client to be used with HTTPS only requests.

Defaults to false.

## reqwest::identity (function)

Sets the identity to be used for client certificate authentication.

### reqwest::identity (function) › Optional

This requires the optional `native-tls` or `rustls(-...)` feature to be
enabled.

## reqwest::identity (function)

Sets the identity to be used for client certificate authentication.

### reqwest::identity (function) › Optional

This requires the optional `native-tls` or `rustls(-...)` feature to be
enabled.

## reqwest::interface (function)

Bind connections only on the specified network interface.

This option is only available on the following operating systems:

- Android
- Fuchsia
- Linux,
- macOS and macOS-like systems (iOS, tvOS, watchOS and visionOS)
- Solaris and illumos

On Android, Linux, and Fuchsia, this uses the
[`SO_BINDTODEVICE`][man-7-socket] socket option. On macOS and macOS-like
systems, Solaris, and illumos, this instead uses the [`IP_BOUND_IF` and
`IPV6_BOUND_IF`][man-7p-ip] socket options (as appropriate).

Note that connections will fail if the provided interface name is not a
network interface that currently exists when a connection is established.

### reqwest::interface (function) › Example

```
# fn doc() -> Result<(), reqwest::Error> {
let interface = "lo";
let client = reqwest::Client::builder()
    .interface(interface)
    .build()?;
# Ok(())
# }
```

[man-7-socket]: https://man7.org/linux/man-pages/man7/socket.7.html
[man-7p-ip]: https://docs.oracle.com/cd/E86824_01/html/E54777/ip-7p.html

## reqwest::interface (function)

Bind to an interface by `SO_BINDTODEVICE`.

### reqwest::interface (function) › Example

```
let interface = "lo";
let client = reqwest::blocking::Client::builder()
    .interface(interface)
    .build().unwrap();
```

## reqwest::into_reader (function)

Produce a reader over the multipart form data.

## reqwest::into_stream (function)

Produce a stream of the bytes in this `Form`, consuming it.

## reqwest::into_url::IntoUrl (trait)

A trait to try to convert some type into a `Url`.

This trait is "sealed", such that only types within reqwest can
implement it.

## reqwest::is_body (function)

Returns true if the error is related to the request or response body

## reqwest::is_builder (function)

Returns true if the error is from a type Builder.

## reqwest::is_connect (function)

Returns true if the error is related to connect

## reqwest::is_decode (function)

Returns true if the error is related to decoding the response's body

## reqwest::is_dns (function)

Returns true if the error is related to DNS resolution.

## reqwest::is_redirect (function)

Returns true if the error is from a `RedirectPolicy`.

## reqwest::is_request (function)

Returns true if the error is related to the request

## reqwest::is_status (function)

Returns true if the error is from `Response::error_for_status`.

## reqwest::is_timeout (function)

Returns true if the error is related to a timeout.

## reqwest::is_upgrade (function)

Returns true if the error is related to a protocol upgrade request

## reqwest::json (function)

Send a JSON body.

Serializes the value to JSON and sets resulting bytes as the body.

Sets Content-Type header to application/json unless the header is already set.

### reqwest::json (function) › Optional

This requires the optional `json` feature enabled.

### reqwest::json (function) › Errors

Serialization can fail if `T`'s implementation of `Serialize` decides to
fail, or if `T` contains a map with non-string keys.

## reqwest::json (function)

Send a JSON body.

Sets the body to the JSON serialization of the passed value, and
also sets the `Content-Type: application/json` header.

### reqwest::json (function) › Optional

This requires the optional `json` feature enabled.

### reqwest::json (function) › Examples

```rust
# use reqwest::Error;
# use std::collections::HashMap;
#
# fn run() -> Result<(), Error> {
let mut map = HashMap::new();
map.insert("lang", "rust");

let client = reqwest::blocking::Client::new();
let res = client.post("http://httpbin.org")
    .json(&map)
    .send()?;
# Ok(())
# }
```

### reqwest::json (function) › Errors

Serialization can fail if `T`'s implementation of `Serialize` decides to
fail, or if `T` contains a map with non-string keys.

## reqwest::json (function)

Try and deserialize the response body as JSON using `serde`.

### reqwest::json (function) › Optional

This requires the optional `json` feature enabled.

### reqwest::json (function) › Examples

```rust
# extern crate reqwest;
# extern crate serde;
#
# use reqwest::Error;
# use serde::Deserialize;
#
// This `derive` requires the `serde` dependency.
#[derive(Deserialize)]
struct Ip {
    origin: String,
}

# fn run() -> Result<(), Error> {
let json: Ip = reqwest::blocking::get("http://httpbin.org/ip")?.json()?;
# Ok(())
# }
#
# fn main() { }
```

### reqwest::json (function) › Errors

This method fails whenever the response body is not in JSON format,
or it cannot be properly deserialized to target type `T`. For more
details please see [`serde_json::from_reader`].

[`serde_json::from_reader`]: https://docs.serde.rs/serde_json/fn.from_reader.html

## reqwest::json (function)

Try to deserialize the response body as JSON.

### reqwest::json (function) › Optional

This requires the optional `json` feature enabled.

### reqwest::json (function) › Examples

```
# extern crate reqwest;
# extern crate serde;
#
# use reqwest::Error;
# use serde::Deserialize;
#
// This `derive` requires the `serde` dependency.
#[derive(Deserialize)]
struct Ip {
    origin: String,
}

# async fn run() -> Result<(), Error> {
let ip = reqwest::get("http://httpbin.org/ip")
    .await?
    .json::<Ip>()
    .await?;

println!("ip: {}", ip.origin);
# Ok(())
# }
#
# fn main() { }
```

### reqwest::json (function) › Errors

This method fails whenever the response body is not in JSON format,
or it cannot be properly deserialized to target type `T`. For more
details please see [`serde_json::from_reader`].

[`serde_json::from_reader`]: https://docs.serde.rs/serde_json/fn.from_reader.html

## reqwest::limited (function)

Create a `Policy` with a maximum number of redirects.

An `Error` will be returned if the max is reached.

## reqwest::local_address (function)

Bind to a local IP Address.

### reqwest::local_address (function) › Example

```
# fn doc() -> Result<(), reqwest::Error> {
use std::net::IpAddr;
let local_addr = IpAddr::from([12, 4, 1, 8]);
let client = reqwest::Client::builder()
    .local_address(local_addr)
    .build()?;
# Ok(())
# }
```

## reqwest::local_address (function)

Bind to a local IP Address.

### reqwest::local_address (function) › Example

```
use std::net::IpAddr;
let local_addr = IpAddr::from([12, 4, 1, 8]);
let client = reqwest::blocking::Client::builder()
    .local_address(local_addr)
    .build().unwrap();
```

## reqwest::max_age (function)

Get the Max-Age information.

## reqwest::max_extra_load (function)

Sets the max extra load the budget will allow.

Think of the amount of requests your client generates, and how much
load that puts on the server. This option configures as a percentage
how much extra load is allowed via retries.

For example, if you send 1,000 requests per second, setting a maximum
extra load value of `0.3` would allow 300 more requests per second
in retries. A value of `2.5` would allow 2,500 more requests.

### reqwest::max_extra_load (function) › Panics

The `extra_percent` value must be within reasonable values for a
percentage. This method will panic if it is less than `0.0`, or greater
than `1000.0`.

## reqwest::max_retries_per_request (function)

Set the max retries allowed per request.

For each logical (initial) request, only retry up to `max` times.

This value is used in combination with a token budget that is applied
to all requests. Even if the budget would allow more requests, this
limit will prevent. Likewise, the budget may prevent retrying up to
`max` times. This setting prevents a single request from consuming
the entire budget.

Default is currently 2 retries.

## reqwest::max_tls_version (function)

Deprecated: use [`ClientBuilder::tls_version_max()`] instead.

## reqwest::max_tls_version (function)

Deprecated: use [`ClientBuilder::tls_version_max()`] instead.

## reqwest::method (function)

Access the request method.

## reqwest::method (function)

Get the method.

## reqwest::method (function)

Get the method.

## reqwest::method_mut (function)

Get a mutable reference to the method.

## reqwest::method_mut (function)

Get a mutable reference to the method.

## reqwest::mime_str (function)

Tries to set the mime of this part.

## reqwest::mime_str (function)

Tries to set the mime of this part.

## reqwest::min_tls_version (function)

Deprecated: use [`ClientBuilder::tls_version_min()`] instead.

## reqwest::min_tls_version (function)

Deprecated: use [`ClientBuilder::tls_version_min()`] instead.

## reqwest::multipart (function)

Sends a multipart/form-data body.

```
# use reqwest::Error;

# async fn run() -> Result<(), Error> {
let client = reqwest::Client::new();
let form = reqwest::multipart::Form::new()
    .text("key3", "value3")
    .text("key4", "value4");


let response = client.post("your url")
    .multipart(form)
    .send()
    .await?;
# Ok(())
# }
```

In additional the request's body, the Content-Type and Content-Length fields are
appropriately set.

## reqwest::multipart (function)

Sends a multipart/form-data body.

```
# use reqwest::Error;

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let form = reqwest::blocking::multipart::Form::new()
    .text("key3", "value3")
    .file("file", "/path/to/field")?;

let response = client.post("your url")
    .multipart(form)
    .send()?;
# Ok(())
# }
```

See [`multipart`](multipart/) for more examples.

## reqwest::name (function)

The name of the cookie.

## reqwest::new (function)

Constructs a new `ClientBuilder`.

This is the same as `Client::builder()`.

## reqwest::new (function)

Constructs a new `ClientBuilder`.

This is the same as `Client::builder()`.

## reqwest::new (function)

Constructs a new `Client`.

### reqwest::new (function) › Panic

This method panics if TLS backend cannot be initialized, or the resolver
cannot load the system configuration.

Use `Client::builder()` if you wish to handle the failure as an `Error`
instead of panicking.

This method also panics if called from within an async runtime. See docs
on [`reqwest::blocking`][crate::blocking] for details.

## reqwest::new (function)

Constructs a new `Client`.

### reqwest::new (function) › Panics

This method panics if a TLS backend cannot be initialized, or the resolver
cannot load the system configuration.

Use `Client::builder()` if you wish to handle the failure as an `Error`
instead of panicking.

## reqwest::new (function)

Constructs a new request.

## reqwest::new (function)

Constructs a new request.

## reqwest::new (function)

Creates a new Form without any content.

## reqwest::new (function)

Creates a new async Form without any content.

## reqwest::new (function)

Instantiate a `Body` from a reader.

### reqwest::new (function) › Note

While allowing for many types to be used, these bodies do not have
a way to reset to the beginning and be reused. This means that when
encountering a 307 or 308 status code, instead of repeating the
request at the new location, the `Response` will be returned with
the redirect status code set.

```rust
# use std::fs::File;
# use reqwest::blocking::Body;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let file = File::open("national_secrets.txt")?;
let body = Body::new(file);
# Ok(())
# }
```

If you have a set of bytes, like `String` or `Vec<u8>`, using the
`From` implementations for `Body` will store the data in a manner
it can be reused.

```rust
# use reqwest::blocking::Body;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let s = "A stringy body";
let body = Body::from(s);
# Ok(())
# }
```

## reqwest::no_brotli (function)

Disable auto response body brotli decompression.

This method exists even if the optional `brotli` feature is not enabled.
This can be used to ensure a `Client` doesn't use brotli decompression
even if another dependency were to enable the optional `brotli` feature.

## reqwest::no_brotli (function)

Disable auto response body brotli decompression.

This method exists even if the optional `brotli` feature is not enabled.
This can be used to ensure a `Client` doesn't use brotli decompression
even if another dependency were to enable the optional `brotli` feature.

## reqwest::no_budget (function)

Set no retry budget.

Sets that no budget will be enforced. This could also be considered
to be an infinite budget.

This is NOT recommended. Disabling the budget can make your system more
susceptible to retry storms.

## reqwest::no_deflate (function)

Disable auto response body deflate decompression.

This method exists even if the optional `deflate` feature is not enabled.
This can be used to ensure a `Client` doesn't use deflate decompression
even if another dependency were to enable the optional `deflate` feature.

## reqwest::no_deflate (function)

Disable auto response body deflate decompression.

This method exists even if the optional `deflate` feature is not enabled.
This can be used to ensure a `Client` doesn't use deflate decompression
even if another dependency were to enable the optional `deflate` feature.

## reqwest::no_gzip (function)

Disable auto response body gzip decompression.

This method exists even if the optional `gzip` feature is not enabled.
This can be used to ensure a `Client` doesn't use gzip decompression
even if another dependency were to enable the optional `gzip` feature.

## reqwest::no_gzip (function)

Disable auto response body gzip decompression.

This method exists even if the optional `gzip` feature is not enabled.
This can be used to ensure a `Client` doesn't use gzip decompression
even if another dependency were to enable the optional `gzip` feature.

## reqwest::no_hickory_dns (function)

Disables the hickory-dns async resolver.

This method exists even if the optional `hickory-dns` feature is not enabled.
This can be used to ensure a `Client` doesn't use the hickory-dns async resolver
even if another dependency were to enable the optional `hickory-dns` feature.

## reqwest::no_hickory_dns (function)

Disables the hickory-dns async resolver.

This method exists even if the optional `hickory-dns` feature is not enabled.
This can be used to ensure a `Client` doesn't use the hickory-dns async resolver
even if another dependency were to enable the optional `hickory-dns` feature.

## reqwest::no_proxy (function)

Clear all `Proxies`, so `Client` will use no proxy anymore.

### reqwest::no_proxy (function) › Note
To add a proxy exclusion list, use [Proxy::no_proxy()]
on all desired proxies instead.

This also disables the automatic usage of the "system" proxy.

## reqwest::no_proxy (function)

Clear all `Proxies`, so `Client` will use no proxy anymore.

### reqwest::no_proxy (function) › Note
To add a proxy exclusion list, use [crate::proxy::Proxy::no_proxy()]
on all desired proxies instead.

This also disables the automatic usage of the "system" proxy.

## reqwest::no_zstd (function)

Disable auto response body zstd decompression.

This method exists even if the optional `zstd` feature is not enabled.
This can be used to ensure a `Client` doesn't use zstd decompression
even if another dependency were to enable the optional `zstd` feature.

## reqwest::no_zstd (function)

Disable auto response body zstd decompression.

This method exists even if the optional `zstd` feature is not enabled.
This can be used to ensure a `Client` doesn't use zstd decompression
even if another dependency were to enable the optional `zstd` feature.

## reqwest::none (function)

Create a `Policy` that does not follow any redirect.

## reqwest::part (function)

Adds a customized Part.

## reqwest::part (function)

Adds a customized Part.

## reqwest::patch (function)

Convenience method to make a `PATCH` request to a URL.

### reqwest::patch (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::patch (function)

Convenience method to make a `PATCH` request to a URL.

### reqwest::patch (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::path (function)

Returns the path directive of the cookie, if set.

## reqwest::peer_certificate (function)

Get the DER encoded leaf certificate of the peer.

## reqwest::percent_encode_attr_chars (function)

Configure this `Form` to percent-encode using the `attr-char` rules.

## reqwest::percent_encode_attr_chars (function)

Configure this `Form` to percent-encode using the `attr-char` rules.

## reqwest::percent_encode_noop (function)

Configure this `Form` to skip percent-encoding

## reqwest::percent_encode_noop (function)

Configure this `Form` to skip percent-encoding

## reqwest::percent_encode_path_segment (function)

Configure this `Form` to percent-encode using the `path-segment` rules.

## reqwest::percent_encode_path_segment (function)

Configure this `Form` to percent-encode using the `path-segment` rules.

## reqwest::pool_idle_timeout (function)

Set an optional timeout for idle sockets being kept-alive.

Pass `None` to disable timeout.

Default is 90 seconds.

## reqwest::pool_max_idle_per_host (function)

Sets the maximum idle connection per host allowed in the pool.

## reqwest::post (function)

Convenience method to make a `POST` request to a URL.

### reqwest::post (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::post (function)

Convenience method to make a `POST` request to a URL.

### reqwest::post (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::previous (function)

Get the list of previous URLs that have already been requested in this chain.

## reqwest::proxy (function)

Add a `Proxy` to the list of proxies the `Client` will use.

### reqwest::proxy (function) › Note

Adding a proxy will disable the automatic usage of the "system" proxy.

## reqwest::proxy (function)

Add a `Proxy` to the list of proxies the `Client` will use.

### reqwest::proxy (function) › Note

Adding a proxy will disable the automatic usage of the "system" proxy.

## reqwest::proxy::IntoProxy (trait)

Trait used for converting into a proxy scheme. This trait supports
parsing from a URL-like type, whilst also supporting proxy schemes
built directly using the factory methods.

## reqwest::proxy::NoProxy (struct)

A configuration for filtering out requests that shouldn't be proxied

## reqwest::proxy::NoProxy::from_string (function)

Returns a new no-proxy configuration based on a `no_proxy` string (or `None` if no variables
are set)
The rules are as follows:
* The environment variable `NO_PROXY` is checked, if it is not set, `no_proxy` is checked
* If neither environment variable is set, `None` is returned
* Entries are expected to be comma-separated (whitespace between entries is ignored)
* IP addresses (both IPv4 and IPv6) are allowed, as are optional subnet masks (by adding /size,
  for example "`192.168.1.0/24`").
* An entry "`*`" matches all hostnames (this is the only wildcard allowed)
* Any other entry is considered a domain name (and may contain a leading dot, for example `google.com`
  and `.google.com` are equivalent) and would match both that domain AND all subdomains.

For example, if `"NO_PROXY=google.com, 192.168.1.0/24"` was set, all the following would match
(and therefore would bypass the proxy):
* `http://google.com/`
* `http://www.google.com/`
* `http://192.168.1.42/`

The URL `http://notgoogle.com/` would not match.

## reqwest::proxy::Proxy (struct)

Configuration of a proxy that a `Client` should pass requests to.

A `Proxy` has a couple pieces to it:

- a URL of how to talk to the proxy
- rules on what `Client` requests should be directed to the proxy

For instance, let's look at `Proxy::http`:

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let proxy = reqwest::Proxy::http("https://secure.example")?;
# Ok(())
# }
```

This proxy will intercept all HTTP requests, and make use of the proxy
at `https://secure.example`. A request to `http://hyper.rs` will talk
to your proxy. A request to `https://hyper.rs` will not.

Multiple `Proxy` rules can be configured for a `Client`. The `Client` will
check each `Proxy` in the order it was added. This could mean that a
`Proxy` added first with eager intercept rules, such as `Proxy::all`,
would prevent a `Proxy` later in the list from ever working, so take care.

By enabling the `"socks"` feature it is possible to use a socks proxy:
```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let proxy = reqwest::Proxy::http("socks5://192.168.1.1:9000")?;
# Ok(())
# }
```

## reqwest::proxy::Proxy::no_proxy (function)

Adds a `No Proxy` exclusion list to this Proxy

### reqwest::proxy::Proxy::no_proxy (function) › Example

```
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let proxy = reqwest::Proxy::https("http://localhost:1234")?
    .no_proxy(reqwest::NoProxy::from_string("direct.tld, sub.direct2.tld"));
# Ok(())
# }
# fn main() {}
```

## reqwest::put (function)

Convenience method to make a `PUT` request to a URL.

### reqwest::put (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::put (function)

Convenience method to make a `PUT` request to a URL.

### reqwest::put (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::query (function)

Modify the query string of the URL.

Modifies the URL of this request, adding the parameters provided.
This method appends and does not overwrite. This means that it can
be called multiple times and that existing query parameters are not
overwritten if the same key is used. The key will simply show up
twice in the query string.
Calling `.query(&[("foo", "a"), ("foo", "b")])` gives `"foo=a&foo=b"`.

### reqwest::query (function) › Note
This method does not support serializing a single key-value
pair. Instead of using `.query(("key", "val"))`, use a sequence, such
as `.query(&[("key", "val")])`. It's also possible to serialize structs
and maps into a key-value pair.

### reqwest::query (function) › Optional

This requires the optional `query` feature to be enabled.

### reqwest::query (function) › Errors
This method will fail if the object you provide cannot be serialized
into a query string.

## reqwest::query (function)

Modify the query string of the URL.

Modifies the URL of this request, adding the parameters provided.
This method appends and does not overwrite. This means that it can
be called multiple times and that existing query parameters are not
overwritten if the same key is used. The key will simply show up
twice in the query string.
Calling `.query(&[("foo", "a"), ("foo", "b")])` gives `"foo=a&foo=b"`.

```rust
# use reqwest::Error;
#
# fn run() -> Result<(), Error> {
let client = reqwest::blocking::Client::new();
let res = client.get("http://httpbin.org")
    .query(&[("lang", "rust")])
    .send()?;
# Ok(())
# }
```

### reqwest::query (function) › Note
This method does not support serializing a single key-value
pair. Instead of using `.query(("key", "val"))`, use a sequence, such
as `.query(&[("key", "val")])`. It's also possible to serialize structs
and maps into a key-value pair.

### reqwest::query (function) › Optional

This requires the optional `query` feature to be enabled.

### reqwest::query (function) › Errors
This method will fail if the object you provide cannot be serialized
into a query string.

## reqwest::read_timeout (function)

Enables a read timeout.

The timeout applies to each read operation, and resets after a
successful read. This is more appropriate for detecting stalled
connections when the size isn't known beforehand.

Default is no timeout.

## reqwest::reader (function)

Adds a generic reader.

Does not set filename or mime.

## reqwest::reader_with_length (function)

Adds a generic reader with known length.

Does not set filename or mime.

## reqwest::redirect (function)

Apply this policy to a given [`Attempt`] to produce a [`Action`].

### reqwest::redirect (function) › Note

This method can be used together with `Policy::custom()`
to construct one `Policy` that wraps another.

### reqwest::redirect (function) › Example

```rust
# use reqwest::{Error, redirect};
#
# fn run() -> Result<(), Error> {
let custom = redirect::Policy::custom(|attempt| {
    eprintln!("{}, Location: {:?}", attempt.status(), attempt.url());
    redirect::Policy::default().redirect(attempt)
});
# Ok(())
# }
```

## reqwest::redirect (function)

Set a `RedirectPolicy` for this client.

Default will follow redirects up to a maximum of 10.

## reqwest::redirect (function)

Set a `redirect::Policy` for this client.

Default will follow redirects up to a maximum of 10.

## reqwest::redirect::Action (struct)

An action to perform when a redirect status code is found.

## reqwest::redirect::Attempt (struct)

A type that holds information on the next request and previous requests
in redirect chain.

## reqwest::redirect::Policy (struct)

A type that controls the policy on how to handle the following of redirects.

The default value will catch redirect loops, and has a maximum of 10
redirects it will follow in a chain before returning an error.

- `limited` can be used have the same as the default behavior, but adjust
  the allowed maximum redirect hops in a chain.
- `none` can be used to disable all redirect behavior.
- `custom` can be used to create a customized policy.

## reqwest::referer (function)

Enable or disable automatic setting of the `Referer` header.

Default is `true`.

## reqwest::referer (function)

Enable or disable automatic setting of the `Referer` header.

Default is `true`.

## reqwest::remote_addr (function)

Get the remote address used to get this `Response`.

## reqwest::remote_addr (function)

Get the remote address used to get this `Response`.

### reqwest::remote_addr (function) › Example

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::blocking::get("http://httpbin.org/redirect/1")?;
println!("httpbin.org address: {:?}", resp.remote_addr());
# Ok(())
# }
```

## reqwest::request (function)

Start building a `Request` with the `Method` and `Url`.

Returns a `RequestBuilder`, which will allow setting headers and
request body before sending.

### reqwest::request (function) › Errors

This method fails whenever supplied `Url` cannot be parsed.

## reqwest::request (function)

Start building a `Request` with the `Method` and `Url`.

Returns a `RequestBuilder`, which will allow setting headers and
the request body before sending.

### reqwest::request (function) › Errors

This method fails whenever the supplied `Url` cannot be parsed.

## reqwest::resolve (function)

Override DNS resolution for specific domains to a particular IP address.

Set the port to `0` to use the conventional port for the given scheme (e.g. 80 for http).
Ports in the URL itself will always be used instead of the port in the overridden addr.

## reqwest::resolve (function)

Override DNS resolution for specific domains to a particular IP address.

Set the port to `0` to use the conventional port for the given scheme (e.g. 80 for http).
Ports in the URL itself will always be used instead of the port in the overridden addr.

## reqwest::resolve (function)

Performs DNS resolution on a `Name`.
The return type is a future containing an iterator of `SocketAddr`.

It differs from `tower_service::Service<Name>` in several ways:
 * It is assumed that `resolve` will always be ready to poll.
 * It does not need a mutable reference to `self`.
 * Since trait objects cannot make use of associated types, it requires
   wrapping the returned `Future` and its contained `Iterator` with `Box`.

Explicitly specified port in the URL will override any port in the resolved `SocketAddr`s.
Otherwise, port `0` will be replaced by the conventional port for the given scheme (e.g. 80 for http).

## reqwest::resolve_to_addrs (function)

Override DNS resolution for specific domains to particular IP addresses.

Set the port to `0` to use the conventional port for the given scheme (e.g. 80 for http).
Ports in the URL itself will always be used instead of the port in the overridden addr.

## reqwest::resolve_to_addrs (function)

Override DNS resolution for specific domains to particular IP addresses.

Set the port to `0` to use the conventional port for the given scheme (e.g. 80 for http).
Ports in the URL itself will always be used instead of the port in the overridden addr.

## reqwest::response::ResponseBuilderExt (trait)

Extension trait for http::response::Builder objects

Allows the user to add a `Url` to the http::Response

## reqwest::retry (function)

Set a request retry policy.

Default behavior is to retry protocol NACKs.

## reqwest::retry (function)

Set a request retry policy.

Default behavior is to retry protocol NACKs.

## reqwest::retry::Builder (struct)

Builder to configure retries

Construct with [`for_host()`].

## reqwest::retry::Builder::scoped (function)

Create a scoped retry policy.

For a more convenient constructor, see [`for_host()`].

## reqwest::retry::classify::ReqRep (struct)

A request/response result to inspect for possible retries.

This is passed to a `classify` function.

## reqwest::retry::for_host (function)

Create a retry builder with a request scope.

To provide a scope that isn't a closure, use the more general
[`Builder::scoped()`].

## reqwest::retry::never (function)

Create a retry policy that will never retry any request.

This is useful for disabling the `Client`s default behavior of retrying
protocol nacks.

## reqwest::retryable (function)

Classify this attempt as retryable.

## reqwest::same_site_lax (function)

Returns true if  'SameSite' directive is 'Lax'.

## reqwest::same_site_strict (function)

Returns true if  'SameSite' directive is 'Strict'.

## reqwest::secure (function)

Returns true if the 'Secure' directive is enabled.

## reqwest::send (function)

Constructs the Request and sends it the target URL, returning a Response.

### reqwest::send (function) › Errors

This method fails if there was an error while sending request,
redirect loop was detected or redirect limit was exhausted.

## reqwest::send (function)

Constructs the Request and sends it to the target URL, returning a
future Response.

### reqwest::send (function) › Errors

This method fails if there was an error while sending request,
redirect loop was detected or redirect limit was exhausted.

### reqwest::send (function) › Example

```no_run
# use reqwest::Error;
#
# async fn run() -> Result<(), Error> {
let response = reqwest::Client::new()
    .get("https://hyper.rs")
    .send()
    .await?;
# Ok(())
# }
```

## reqwest::set_cookies (function)

Store a set of Set-Cookie header values received from `url`

## reqwest::sized (function)

Create a `Body` from a `Read` where the size is known in advance
but the data should not be fully loaded into memory. This will
set the `Content-Length` header and stream from the `Read`.

```rust
# use std::fs::File;
# use reqwest::blocking::Body;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let file = File::open("a_large_file.txt")?;
let file_size = file.metadata()?.len();
let body = Body::sized(file, file_size);
# Ok(())
# }
```

## reqwest::status (function)

Access the response status, if it did not error.

## reqwest::status (function)

Get the `StatusCode` of this `Response`.

## reqwest::status (function)

Get the `StatusCode` of this `Response`.

### reqwest::status (function) › Examples

Checking for general status class:

```rust
# #[cfg(feature = "json")]
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::blocking::get("http://httpbin.org/get")?;
if resp.status().is_success() {
    println!("success!");
} else if resp.status().is_server_error() {
    println!("server error!");
} else {
    println!("Something else happened. Status: {:?}", resp.status());
}
# Ok(())
# }
```

Checking for specific status codes:

```rust
use reqwest::blocking::Client;
use reqwest::StatusCode;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();

let resp = client.post("http://httpbin.org/post")
    .body("possibly too large")
    .send()?;

match resp.status() {
    StatusCode::OK => println!("success!"),
    StatusCode::PAYLOAD_TOO_LARGE => {
        println!("Request payload is too large!");
    }
    s => println!("Received response status: {s:?}"),
};
# Ok(())
# }
```

## reqwest::status (function)

Get the type of redirect.

## reqwest::status (function)

Returns the status code, if the error was generated from a response.

## reqwest::stop (function)

Returns an action meaning reqwest should not follow the next URL.

The 30x response will be returned as the `Ok` result.

## reqwest::stream (function)

Makes a new parameter from an arbitrary stream.

## reqwest::stream_with_length (function)

Makes a new parameter from an arbitrary stream with a known length. This is particularly
useful when adding something like file contents as a stream, where you can know the content
length beforehand.

## reqwest::success (function)

Classify this attempt as success.

Even if it was a domain error, a "success" means it will not retry.

## reqwest::tcp_keepalive (function)

Set that all sockets have `SO_KEEPALIVE` set with the supplied duration.

If `None`, the option will not be set.

## reqwest::tcp_keepalive (function)

Set that all sockets have `SO_KEEPALIVE` set with the supplied duration.

If `None`, the option will not be set.

## reqwest::tcp_keepalive_interval (function)

Set that all sockets have `SO_KEEPALIVE` set with the supplied interval.

If `None`, the option will not be set.

## reqwest::tcp_keepalive_interval (function)

Set that all sockets have `SO_KEEPALIVE` set with the supplied interval.

If `None`, the option will not be set.

## reqwest::tcp_keepalive_retries (function)

Set that all sockets have `SO_KEEPALIVE` set with the supplied retry count.

If `None`, the option will not be set.

## reqwest::tcp_keepalive_retries (function)

Set that all sockets have `SO_KEEPALIVE` set with the supplied retry count.

If `None`, the option will not be set.

## reqwest::tcp_nodelay (function)

Set whether sockets have `TCP_NODELAY` enabled.

Default is `true`.

## reqwest::tcp_nodelay (function)

Set whether sockets have `TCP_NODELAY` enabled.

Default is `true`.

## reqwest::tcp_user_timeout (function)

Set that all sockets have `TCP_USER_TIMEOUT` set with the supplied duration.

This option controls how long transmitted data may remain unacknowledged before
the connection is force-closed.

If `None`, the option will not be set.

## reqwest::tcp_user_timeout (function)

Set that all sockets have `TCP_USER_TIMEOUT` set with the supplied duration.

This option controls how long transmitted data may remain unacknowledged before
the connection is force-closed.

The current default is `None` (option disabled).

## reqwest::text (function)

Add a data field with supplied name and value.

### reqwest::text (function) › Examples

```
let form = reqwest::blocking::multipart::Form::new()
    .text("username", "seanmonstar")
    .text("password", "secret");
```

## reqwest::text (function)

Add a data field with supplied name and value.

### reqwest::text (function) › Examples

```
let form = reqwest::multipart::Form::new()
    .text("username", "seanmonstar")
    .text("password", "secret");
```

## reqwest::text (function)

Get the full response text.

This method decodes the response body with BOM sniffing
and with malformed sequences replaced with the
[`char::REPLACEMENT_CHARACTER`].
Encoding is determined from the `charset` parameter of `Content-Type` header,
and defaults to `utf-8` if not presented.

Note that the BOM is stripped from the returned String.

### reqwest::text (function) › Note

If the `charset` feature is disabled the method will only attempt to decode the
response as UTF-8, regardless of the given `Content-Type`

### reqwest::text (function) › Example

```
# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let content = reqwest::get("http://httpbin.org/range/26")
    .await?
    .text()
    .await?;

println!("text: {content:?}");
# Ok(())
# }
```

## reqwest::text (function)

Get the response text.

This method decodes the response body with BOM sniffing
and with malformed sequences replaced with the [`char::REPLACEMENT_CHARACTER`].
Encoding is determined from the `charset` parameter of `Content-Type` header,
and defaults to `utf-8` if not presented.

### reqwest::text (function) › Note

If the `charset` feature is disabled the method will only attempt to decode the
response as UTF-8, regardless of the given `Content-Type`

### reqwest::text (function) › Example

```rust
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let content = reqwest::blocking::get("http://httpbin.org/range/26")?.text()?;
# Ok(())
# }
```

## reqwest::text (function)

Makes a text parameter.

## reqwest::text (function)

Makes a text parameter.

## reqwest::text_with_charset (function)

Get the full response text given a specific encoding.

This method decodes the response body with BOM sniffing
and with malformed sequences replaced with the [`char::REPLACEMENT_CHARACTER`].
You can provide a default encoding for decoding the raw message, while the
`charset` parameter of `Content-Type` header is still prioritized. For more information
about the possible encoding name, please go to [`encoding_rs`] docs.

Note that the BOM is stripped from the returned String.

[`encoding_rs`]: https://docs.rs/encoding_rs/0.8/encoding_rs/#relationship-with-windows-code-pages

### reqwest::text_with_charset (function) › Optional

This requires the optional `encoding_rs` feature enabled.

### reqwest::text_with_charset (function) › Example

```
# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let content = reqwest::get("http://httpbin.org/range/26")
    .await?
    .text_with_charset("utf-8")
    .await?;

println!("text: {content:?}");
# Ok(())
# }
```

## reqwest::text_with_charset (function)

Get the response text given a specific encoding.

This method decodes the response body with BOM sniffing
and with malformed sequences replaced with the [`char::REPLACEMENT_CHARACTER`].
You can provide a default encoding for decoding the raw message, while the
`charset` parameter of `Content-Type` header is still prioritized. For more information
about the possible encoding name, please go to [`encoding_rs`] docs.

[`encoding_rs`]: https://docs.rs/encoding_rs/0.8/encoding_rs/#relationship-with-windows-code-pages

### reqwest::text_with_charset (function) › Optional

This requires the optional `charset` feature enabled.

### reqwest::text_with_charset (function) › Example

```rust
# extern crate reqwest;
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let content = reqwest::blocking::get("http://httpbin.org/range/26")?
    .text_with_charset("utf-8")?;
# Ok(())
# }
```

## reqwest::timeout (function)

Enables a request timeout.

The timeout is applied from when the request starts connecting until the
response body has finished. It affects only this request and overrides
the timeout configured using `ClientBuilder::timeout()`.

## reqwest::timeout (function)

Enables a request timeout.

The timeout is applied from when the request starts connecting until the
response body has finished. It affects only this request and overrides
the timeout configured using `ClientBuilder::timeout()`.

## reqwest::timeout (function)

Enables a total request timeout.

The timeout is applied from when the request starts connecting until the
response body has finished. Also considered a total deadline.

Default is no timeout.

## reqwest::timeout (function)

Get the timeout.

## reqwest::timeout (function)

Get the timeout.

## reqwest::timeout (function)

Set a timeout for connect, read and write operations of a `Client`.

Default is 30 seconds.

Pass `None` to disable timeout.

## reqwest::timeout_mut (function)

Get a mutable reference to the timeout.

## reqwest::timeout_mut (function)

Get a mutable reference to the timeout.

## reqwest::tls::Certificate (struct)

Represents a server X509 certificate.

## reqwest::tls::CertificateRevocationList (struct)

Represents a X509 certificate revocation list.

## reqwest::tls::Identity (struct)

Represents a private key and X509 cert as a client certificate.

## reqwest::tls::TlsInfo (struct)

Hyper extension carrying extra TLS layer information.
Made available to clients on responses when `tls_info` is set.

## reqwest::tls::Version (struct)

A TLS protocol version.

## reqwest::tls_early_data (function)

Whether to send data on the first flight ("early data") in TLS 1.3 handshakes
for HTTP/3 connections.

The default is false.

## reqwest::tls_info (function)

Add TLS information as `TlsInfo` extension to responses.

### reqwest::tls_info (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::tls_info (function)

Add TLS information as `TlsInfo` extension to responses.

### reqwest::tls_info (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::tls_sni (function)

Controls the use of TLS server name indication.

Defaults to `true`.

## reqwest::tls_sni (function)

Controls the use of TLS server name indication.

Defaults to `true`.

### reqwest::tls_sni (function) › Optional

This requires the optional `default-tls`, `native-tls`, or `rustls(-...)`
feature to be enabled.

## reqwest::tls_sslkeylogfile (function)

Controls if the SSLKEYLOGFILE environment variable is respected.

When enabled, if the environment variable `SSLKEYLOGFILE` is present at runtime,
TLS keys will be logged to the file at the path described in the variable.
This can be used by end-users to allow debugging TLS connections.

Defaults to `false`.

### reqwest::tls_sslkeylogfile (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::tls_sslkeylogfile (function)

Controls if the SSLKEYLOGFILE environment variable is respected.

When enabled, if the environment variable `SSLKEYLOGFILE` is present at runtime,
TLS keys will be logged to the file at the path described in the variable.
This can be used by end-users to allow debugging TLS connections.

Defaults to `false`.

### reqwest::tls_sslkeylogfile (function) › Optional

This requires the `rustls(-...)` Cargo feature enabled.

## reqwest::try_clone (function)

Attempt to clone the RequestBuilder.

`None` is returned if the RequestBuilder can not be cloned,
i.e. if the request body is a stream.

### reqwest::try_clone (function) › Examples

```
# use reqwest::Error;
#
# fn run() -> Result<(), Error> {
let client = reqwest::Client::new();
let builder = client.post("http://httpbin.org/post")
    .body("from a &str!");
let clone = builder.try_clone();
assert!(clone.is_some());
# Ok(())
# }
```

## reqwest::try_clone (function)

Attempt to clone the request.

`None` is returned if the request can not be cloned, i.e. if the body is a stream.

## reqwest::try_clone (function)

Attempts to clone the `RequestBuilder`.

None is returned if a body is which can not be cloned. This can be because the body is a
stream.

### reqwest::try_clone (function) › Examples

With a static body

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let builder = client.post("http://httpbin.org/post")
    .body("from a &str!");
let clone = builder.try_clone();
assert!(clone.is_some());
# Ok(())
# }
```

Without a body

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let builder = client.get("http://httpbin.org/get");
let clone = builder.try_clone();
assert!(clone.is_some());
# Ok(())
# }
```

With a non-cloneable body

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let builder = client.get("http://httpbin.org/get")
    .body(reqwest::blocking::Body::new(std::io::empty()));
let clone = builder.try_clone();
assert!(clone.is_none());
# Ok(())
# }
```

## reqwest::try_clone (function)

Attempts to clone the `Request`.

None is returned if a body is which can not be cloned. This can be because the body is a
stream.

## reqwest::unix_socket (function)

Set that all connections will use this Unix socket.

If a request URI uses the `https` scheme, TLS will still be used over
the Unix socket.

### reqwest::unix_socket (function) › Note

This option is not compatible with any of the TCP or Proxy options.
Setting this will ignore all those options previously set.

Likewise, DNS resolution will not be done on the domain name.

## reqwest::unix_socket (function)

Set that all connections will use this Unix socket.

If a request URI uses the `https` scheme, TLS will still be used over
the Unix socket.

### reqwest::unix_socket (function) › Note

This option is not compatible with any of the TCP or Proxy options.
Setting this will ignore all those options previously set.

Likewise, DNS resolution will not be done on the domain name.

## reqwest::upgrade (function)

Consumes the response and returns a future for a possible HTTP upgrade.

## reqwest::uri (function)

Access the request URI.

## reqwest::url (function)

A builder method for the `http::response::Builder` type that allows the user to add a `Url`
to the `http::Response`

## reqwest::url (function)

Get the final `Url` of this `Response`.

## reqwest::url (function)

Get the final `Url` of this `Response`.

### reqwest::url (function) › Example

```rust
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::blocking::get("http://httpbin.org/redirect/1")?;
assert_eq!(resp.url().as_str(), "http://httpbin.org/get");
# Ok(())
# }
```

## reqwest::url (function)

Get the next URL to redirect to.

## reqwest::url (function)

Get the url.

## reqwest::url (function)

Get the url.

## reqwest::url (function)

Returns a possible URL related to this error.

### reqwest::url (function) › Examples

```
# async fn run() {
// displays last stop of a redirect loop
let response = reqwest::get("http://site.with.redirect.loop").await;
if let Err(e) = response {
    if e.is_redirect() {
        if let Some(final_stop) = e.url() {
            println!("redirect loop at {final_stop}");
        }
    }
}
# }
```

## reqwest::url_mut (function)

Get a mutable reference to the url.

## reqwest::url_mut (function)

Get a mutable reference to the url.

## reqwest::url_mut (function)

Returns a mutable reference to the URL related to this error

This is useful if you need to remove sensitive information from the URL
(e.g. an API key in the query), but do not want to remove the URL
entirely.

## reqwest::use_native_tls (function)

Deprecated: use [`ClientBuilder::tls_backend_native()`] instead.

## reqwest::use_native_tls (function)

Deprecated: use [`ClientBuilder::tls_backend_native()`] instead.

## reqwest::use_preconfigured_tls (function)

Deprecated: use [`ClientBuilder::tls_backend_preconfigured()`] instead.

## reqwest::use_preconfigured_tls (function)

Deprecated: use [`ClientBuilder::tls_backend_preconfigured()`] instead.

## reqwest::use_rustls_tls (function)

Deprecated: use [`ClientBuilder::tls_backend_rustls()`] instead.

## reqwest::use_rustls_tls (function)

Deprecated: use [`ClientBuilder::tls_backend_rustls()`] instead.

## reqwest::user_agent (function)

Sets the `User-Agent` header to be used by this client.

### reqwest::user_agent (function) › Example

```rust
# async fn doc() -> Result<(), reqwest::Error> {
// Name your user agent after your app?
static APP_USER_AGENT: &str = concat!(
    env!("CARGO_PKG_NAME"),
    "/",
    env!("CARGO_PKG_VERSION"),
);

let client = reqwest::Client::builder()
    .user_agent(APP_USER_AGENT)
    .build()?;
let res = client.get("https://www.rust-lang.org").send().await?;
# Ok(())
# }
```

## reqwest::user_agent (function)

Sets the `User-Agent` header to be used by this client.

### reqwest::user_agent (function) › Example

```rust
# fn doc() -> Result<(), reqwest::Error> {
// Name your user agent after your app?
static APP_USER_AGENT: &str = concat!(
    env!("CARGO_PKG_NAME"),
    "/",
    env!("CARGO_PKG_VERSION"),
);

let client = reqwest::blocking::Client::builder()
    .user_agent(APP_USER_AGENT)
    .build()?;
let res = client.get("https://www.rust-lang.org").send()?;
# Ok(())
# }
```

## reqwest::value (function)

The value of the cookie.

## reqwest::version (function)

Get the HTTP `Version` of this `Response`.

## reqwest::version (function)

Get the HTTP `Version` of this `Response`.

## reqwest::version (function)

Get the TLS protocol version negotiated with the peer.

Returns `None` if the TLS backend cannot report it. The `native-tls`
backend never reports a version.

## reqwest::version (function)

Get the http version.

## reqwest::version (function)

Get the http version.

## reqwest::version (function)

Set HTTP version

## reqwest::version (function)

Set HTTP version

## reqwest::version_mut (function)

Get a mutable reference to the http version.

## reqwest::version_mut (function)

Get a mutable reference to the http version.

## reqwest::with_url (function)

Add a url related to this error (overwriting any existing)

## reqwest::wrap (function)

Wrap a [`HttpBody`] in a box inside `Body`.

### reqwest::wrap (function) › Example

```
# use reqwest::Body;
# use futures_util;
# fn main() {
let content = "hello,world!".to_string();

let body = Body::wrap(content);
# }
```

## reqwest::wrap_stream (function)

Wrap a futures `Stream` in a box inside `Body`.

### reqwest::wrap_stream (function) › Example

```
# use reqwest::Body;
# use futures_util;
# fn main() {
let chunks: Vec<Result<_, ::std::io::Error>> = vec![
    Ok("hello"),
    Ok(" "),
    Ok("world"),
];

let stream = futures_util::stream::iter(chunks);

let body = Body::wrap_stream(stream);
# }
```

### reqwest::wrap_stream (function) › Optional

This requires the `stream` feature to be enabled.

## reqwest::zstd (function)

Enable auto zstd decompression by checking the `Content-Encoding` response header.

If auto zstd decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `zstd`.
  The request body is **not** automatically compressed.
- When receiving a response, if its headers contain a `Content-Encoding` value of
  `zstd`, both `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `zstd` feature is turned on, the default option is enabled.

### reqwest::zstd (function) › Optional

This requires the optional `zstd` feature to be enabled

## reqwest::zstd (function)

Enable auto zstd decompression by checking the `Content-Encoding` response header.

If auto zstd decompression is turned on:

- When sending a request and if the request's headers do not already contain
  an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `zstd`.
  The request body is **not** automatically compressed.
- When receiving a response, if its headers contain a `Content-Encoding` value of
  `zstd`, both `Content-Encoding` and `Content-Length` are removed from the
  headers' set. The response body is automatically decompressed.

If the `zstd` feature is turned on, the default option is enabled.

### reqwest::zstd (function) › Optional

This requires the optional `zstd` feature to be enabled

