http-body
The trait representing an asynchronous, streaming HTTP request or response body across the Rust hyper ecosystem
Repository Health
Technical Analysis
http-body defines a single, minimal trait — Body — that represents an asynchronous, streaming HTTP body: something that yields a sequence of data frames and trailers over time rather than a single in-memory buffer. It’s the interoperability layer that lets hyper, tower, axum, tonic, and other Rust HTTP libraries pass request/response bodies between each other without every crate needing to agree on one concrete body type.
Because it’s a trait rather than a body implementation, http-body itself has almost no logic — the companion http-body-util crate (developed in the same workspace) provides ready-made implementations (Empty, Full, Collected, Limited, a StreamBody adapter, and combinators) so most consumers never need to implement the trait by hand.
What You Get
- The core
Bodytrait:poll_framefor pulling the next data/trailer frame asynchronously - A
Frametype distinguishing data chunks from HTTP trailers in the same streaming interface SizeHintfor communicating known/estimated body length to callers (e.g. forContent-Length)- A stable, minimal-dependency (only
bytes+http) interop point other crates build concrete bodies against - Companion
http-body-utilcrate (same repo) with ready-made body implementations and combinators so most users don’t implement the trait directly
Common Use Cases
- Writing a middleware in
tower/axum/tonicthat needs to accept or return an arbitrary streaming HTTP body type - Implementing a custom HTTP client or server body type that needs to interoperate with the hyper ecosystem
- Streaming large file or proxy responses through a Rust HTTP stack without buffering the whole body in memory
- Adapting a
futures::Streamof bytes into an HTTP body accepted by hyper-based servers, viahttp-body-util’sStreamBody - Building gRPC (
tonic) handlers that need trailer support on top of a streaming body abstraction
Under The Hood
Architecture — The crate is deliberately tiny: http-body/src/lib.rs (~230 lines) defines the Body trait itself around a single poll_frame method, frame.rs defines the Frame<Data> enum distinguishing data chunks from trailers, and size_hint.rs provides the SizeHint type. It ships no concrete body implementations — those live in the sibling http-body-util crate in the same Cargo workspace (Empty, Full, Collected, Limited, StreamBody, plus combinators under combinators/), keeping the trait definition free of the implementation churn that would force every downstream crate to bump in lockstep.
Tech Stack — Pure Rust, edition 2018, MSRV 1.61. Its only dependencies are bytes (for zero-copy byte buffers) and http (for the HeaderMap used in trailers) — no async-runtime dependency at all, which is what lets it sit underneath both tokio-based and other-runtime-based HTTP stacks without imposing a runtime choice.
Code Quality — As a foundational, widely-depended-on interop trait (700M+ cumulative downloads per the registry), the crate is intentionally conservative: the trait surface has been stable since the 1.0 release with only incremental additions, CI runs on every push/PR, and the workspace’s http-body-util carries its own test suite for the concrete body implementations built on top of the trait. Recent commit velocity is modest, which is expected for a stabilized, narrowly-scoped interop crate rather than a sign of neglect.
API Design — The entire public contract is one trait with one required method (poll_frame) plus a size_hint() default, making implementing Body for a custom type a small, well-documented exercise; docs.rs hosts thorough rustdoc with the trait’s contract clearly spelled out. Because most consumers use http-body-util’s ready-made implementations instead of hand-rolling the trait, the practical day-to-day API surface most developers touch is Full::new(bytes) or StreamBody::new(stream) rather than the trait itself — keeping the common path simple despite the low-level nature of what it standardizes.
Used by 22 apps in this directory
cmux
Developer Tools · AI Development
A native, Ghostty-based macOS terminal with vertical tabs, agent-aware notifications, and a scriptable browser built for running many parallel AI coding agent sessions instead of juggling tmux panes.
cmux
Developer Tools · AI Development
A native, Ghostty-based macOS terminal with vertical tabs, agent-aware notifications, and a scriptable browser built for running many parallel AI coding agent sessions instead of juggling tmux panes.
Cog
AI Development · Devops · Developer Tools
An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.
CubeSandbox
Developer Tools · Security · AI Agents
Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.
fabro
Developer Tools · Devops
Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.
hoop
Security · Monitoring
A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.
iii
Developer Tools · Devops
Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.
Jan
AI Assistants
Run LLMs 100% locally with full privacy, or connect to cloud AI — your machine, your data, your control.