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 = get;
fetch;
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.