9 releases (breaking)
| 0.7.1 | Mar 23, 2026 |
|---|---|
| 0.6.0 | Dec 5, 2025 |
| 0.5.0 | Feb 16, 2024 |
| 0.3.1 | Sep 27, 2023 |
| 0.1.0 | Sep 3, 2021 |
#20 in HTTP client
195,955 downloads per month
Used in 139 crates
(41 directly)
51KB
909 lines
ehttp: a minimal Rust HTTP client for both native and WASM
If you want to do HTTP requests and are targeting both native, web (WASM) and NodeJS (since v18.0), then this is the crate for you!
You can try the web demo here (works in any browser with WASM and WebGL support). Uses eframe.
Usage
let request = ehttp::Request::get("https://www.example.com");
ehttp::fetch(request, move |result: ehttp::Result<ehttp::Response>| {
println!("Status code: {:?}", result.unwrap().status);
});
The given callback is called when the request is completed. You can communicate the results back to the main thread using something like:
- Channels (e.g.
std::sync::mpsc::channel). Arc<Mutex<_>>poll_promise::Promiseeventuals::Eventualtokio::sync::watch::channel
There is also a streaming version under ehttp::fetch::streaming, hidden behind the streaming feature flag.
Dependencies
~0.2–15MB
~163K SLoC