Req is an Elixir HTTP client with a high-level API and composable steps for decoding, redirects, retries, auth, and streaming.
Overview
Req is a batteries-included HTTP client for Elixir. With a few lines of setup you get automatic response decoding, redirect following, error retries, and related behavior. Features are split into individual steps that you can reorder, reuse, or replace with custom logic.
The library exposes convenience calls such as get and post, streaming APIs, and a request struct for shared defaults like base URLs. Built-in steps cover body compression and decompression (gzip, brotli, zstd), JSON and form encoding, query params, path templates, several authentication styles, AWS Sig V4, ranges, checksum verification, redirects, retries, and HTTP error handling.
Request and response bodies can stream from enumerables or into collectables or callbacks. Req plugs into Finch by default with swappable adapters, supports running against a Plug for tests via Req.Test, and allows packaging custom steps as plugins. Related community packages extend S3, GitHub OAuth, HTML parsing, proxies, and server-sent events.
Configuration is centralized on Req.new with lower-level pool and timeout options documented for the Finch adapter. The design draws on patterns from common HTTP tools while staying idiomatic to Elixir's step pipeline model.
Key features
- Composable request and response steps
- Automatic decode and decompression
- Redirect follow and retry on errors
- JSON, multipart, and urlencoded bodies
- Bearer, Digest, Basic, and AWS auth
- Request and response streaming
- Plug-based test doubles
- Finch adapter by default
Use cases
- Calling REST APIs from Elixir
- Shared HTTP client with base URL
- Custom middleware via steps or plugins
- Streaming uploads and downloads