ConfigsApr 13, 2026·3 min read

Reqwest — Ergonomic HTTP Client for Rust

Reqwest is the most popular HTTP client library for Rust. It provides a high-level, async API for making HTTP requests with automatic JSON serialization, TLS, cookie management, proxy support, and connection pooling — the Rust equivalent of Python requests.

TL;DR
Reqwest provides a high-level async HTTP client for Rust with JSON, TLS, cookies, and connection pooling.
§01

What it is

Reqwest is the most widely used HTTP client library for Rust. It provides a high-level, async-first API for making HTTP requests with automatic JSON serialization via serde, native TLS or rustls, cookie management, proxy support, connection pooling, and redirect handling. It sits on top of hyper for the HTTP layer and tokio for async runtime.

Reqwest targets Rust developers building API clients, web scrapers, microservice integrations, or any application that needs to make HTTP calls. It is the Rust equivalent of Python's requests library.

§02

How it saves time or tokens

Using hyper directly requires manually handling connection management, TLS configuration, body streaming, and response parsing. Reqwest wraps all of this in a clean API. A JSON POST request that would take 20+ lines with hyper takes 3 lines with reqwest. The built-in connection pool reuses TCP connections automatically, improving throughput without extra code.

§03

How to use

  1. Add reqwest with JSON support: cargo add reqwest --features json and add tokio: cargo add tokio --features full.
  2. Create a reqwest::Client (reuse it across requests for connection pooling).
  3. Call .get(), .post(), .json(), etc. and .await the response.
§04

Example

use reqwest;
use serde::Deserialize;

#[derive(Deserialize, Debug)]
struct User {
    login: String,
    id: u64,
    public_repos: u32,
}

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    // Simple GET
    let body = reqwest::get('https://httpbin.org/get')
        .await?
        .text()
        .await?;
    println!('Body: {}', &body[..100]);

    // Typed JSON response
    let user: User = reqwest::get('https://api.github.com/users/rust-lang')
        .await?
        .json()
        .await?;
    println!('User: {:?}', user);

    Ok(())
}
§05

Related on TokRepo

§06

Common pitfalls

  • Creating a new reqwest::Client per request instead of reusing one. Each client creates its own connection pool and TLS sessions, wasting resources.
  • Forgetting to enable the json feature flag and getting compile errors when calling .json() on responses.
  • Using the blocking client (reqwest::blocking) inside an async runtime, which panics. Use the async API within tokio/async-std contexts.

Frequently Asked Questions

Does reqwest support HTTP/2?+

Yes. Reqwest supports HTTP/2 via the h2 crate. When you connect to an HTTPS endpoint that supports HTTP/2, reqwest negotiates it automatically via ALPN. You can also force HTTP/2 with the client builder. HTTP/2 multiplexes multiple requests over a single connection, reducing latency.

What is the difference between reqwest and hyper?+

Hyper is a low-level HTTP library that handles the protocol layer. Reqwest is a high-level client built on hyper that adds connection pooling, cookies, redirects, JSON serialization, and a simpler API. Use hyper when you need fine-grained control over the HTTP layer; use reqwest for everyday HTTP requests.

Can I use reqwest without tokio?+

Reqwest provides a `blocking` module that wraps the async client in a synchronous API. This does not require tokio in your own code (reqwest spawns a runtime internally). However, the async API with tokio is the recommended approach for production applications.

How does reqwest handle TLS?+

By default, reqwest uses the platform's native TLS library (OpenSSL on Linux, Secure Transport on macOS, SChannel on Windows). You can switch to rustls (a pure-Rust TLS implementation) via the `rustls-tls` feature flag. Rustls avoids C dependencies and simplifies cross-compilation.

Does reqwest support streaming responses?+

Yes. Use `.bytes_stream()` on a response to get a `Stream<Item = Result<Bytes>>` that you can process chunk by chunk. This is essential for downloading large files or processing server-sent events without loading the entire response into memory.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets