$ reqwest-middleware

v0.5.2

Wrapper around reqwest to allow for client middleware chains.

Downloads: 59.2M
Recent: 12.9M
Versions: 23
Updated: May 19, 2026

Latest Update Summary

Crate

Name: reqwest-middleware New version: 0.5.0 Release date: 2026-01-07T23:58:59.440250Z

Crate readme

Short description A crate implementing a wrapper around reqwest to allow for client middleware chains.

Long description This crate provides functionality for building and running middleware but no middleware implementations. The reqwest-middleware client exposes the same interface as a plain reqwest client, allowing the attachment of middleware.

Features • reqwest-retry: retry failed requests • reqwest-tracing: tracing integration with optional opentelemetry support • tokio support with macros and multi-threaded runtime

Code Examples Add to Cargo.toml

 [dependencies]
reqwest = "0.13"
reqwest-middleware = "0.5"
reqwest-retry = "0.9"
reqwest-tracing = "0.6"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }

Basic usage

 use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry::{RetryTransientMiddleware, policies::ExponentialBackoff};
use reqwest_tracing::TracingMiddleware;

#[tokio::main]
async fn main() {
    let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3);
    let client = ClientBuilder::new(reqwest::Client::new())
        .with(TracingMiddleware::default())
        .with(RetryTransientMiddleware::new_with_policy(retry_policy))
        .build();
    run(client).await;
}

async fn run(client: ClientWithMiddleware) {
    client
        .get("https://truelayer.com")
        .header("foo", "bar")
        .send()
        .await
        .unwrap();
}

Linkshttps://crates.io/crates/reqwesthttps://crates.io/crates/reqwest-retryhttps://crates.io/crates/reqwest-tracinghttps://github.com/TrueLayer/reqwest-middleware/pull/105https://github.com/oxidecomputer/reqwest-conditional-middlewarehttps://github.com/06chaynes/http-cachehttps://gitlab.com/famedly/company/backend/libraries/reqwest-cachehttps://github.com/neoeinstein/aliri/tree/main/aliri_reqwesthttps://crates.io/crates/http-signature-normalization-reqwesthttps://github.com/tommilligan/reqwest-chain

https://api.github.com/repos/TrueLayer/reqwest-middleware/releases/274995236

Release info

Release version:

Release description

Code Examples

Patch update: 0.5.1 → 0.5.2

$ DOWNLOADS TREND

34.4M59.2M

$ VERSION HISTORY

v0.5.2May 19, 2026
v0.5.1February 5, 2026
v0.5.0January 7, 2026
v0.4.2April 8, 2025

$ LINKS

$ INSTALL

cargo add reqwest-middleware

Or add to Cargo.toml: reqwest-middleware = "0.5.2"