http-body

The trait representing an asynchronous, streaming HTTP request or response body across the Rust hyper ecosystem

Library
Cargo
v1.1.0
173 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
69 /100 Good
Development Activity 68
Maintenance 52
Community 76
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 85
Code Quality 82
Innovation 75
Learning Curve 70

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 Body trait: poll_frame for pulling the next data/trailer frame asynchronously
  • A Frame type distinguishing data chunks from HTTP trailers in the same streaming interface
  • SizeHint for communicating known/estimated body length to callers (e.g. for Content-Length)
  • A stable, minimal-dependency (only bytes + http) interop point other crates build concrete bodies against
  • Companion http-body-util crate (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/tonic that 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::Stream of bytes into an HTTP body accepted by hyper-based servers, via http-body-util’s StreamBody
  • 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 26 apps in this directory

Swift
62%
GPL 3.0

cmux

AI Development · Developer Tools

27,452

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.

View details
84
Repo Health
81
Technical
69
Dependency
Built with
Swift 62%
Rust 13%
Updated 4 days ago
Swift
62%
GPL 3.0

cmux

AI Development · Developer Tools

27,452

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.

View details
84
Repo Health
81
Technical
69
Dependency
Built with
Swift 62%
Rust 13%
Updated 4 days ago
Go
59%
Apache 2.0

Cog

AI Development · Developer Tools · Devops

9,484

An open-source CLI that packages machine learning models into standard, production-ready Docker containers — no Dockerfile wrangling, no CUDA version hell.

View details
85
Repo Health
88
Technical
69
Dependency
Built with
Go 59%
Rust 17%
HTML 13%
Updated 1 weeks ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

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.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
Rust
80%
MIT

fabro

Developer Tools · Devops

1,658

Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.

View details
82
Repo Health
83
Technical
67
Dependency
Built with
Rust 80%
TypeScript 15%
Updated 5 days ago
Python
82%
Apache 2.0

headroom

AI Development · Developer Tools

73,966

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.

View details
85
Repo Health
86
Technical
69
Dependency
Built with
Python 82%
Rust 12%
Updated 5 days ago
Go
64%
MIT

hoop

Monitoring · Security

823

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
85
Repo Health
80
Technical
64
Dependency
Built with
Go 64%
Clojure 17%
JavaScript 11%
Updated 1 weeks ago
Rust
73%
Other

iii

Developer Tools · Devops

18,814

Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 73%
TypeScript 16%
Updated 5 days ago
Rust
52%
Other

Jan

AI Assistants

44,680

Run LLMs 100% locally with full privacy, or connect to cloud AI — your machine, your data, your control.

View details
90
Repo Health
81
Technical
65
Dependency
Built with
Rust 52%
TypeScript 44%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers