6 releases (breaking)

0.5.0 Feb 16, 2024
0.4.0 Jan 17, 2024
0.3.1 Sep 27, 2023
0.3.0 Jun 15, 2023
0.1.0 Sep 3, 2021

#136 in Network programming

Download history 3288/week @ 2023-12-20 2501/week @ 2023-12-27 6341/week @ 2024-01-03 4875/week @ 2024-01-10 7642/week @ 2024-01-17 7079/week @ 2024-01-24 6705/week @ 2024-01-31 6832/week @ 2024-02-07 6574/week @ 2024-02-14 5010/week @ 2024-02-21 5646/week @ 2024-02-28 5413/week @ 2024-03-06 6504/week @ 2024-03-13 9654/week @ 2024-03-20 9693/week @ 2024-03-27 5302/week @ 2024-04-03

32,265 downloads per month
Used in 47 crates (15 directly)

MIT/Apache

41KB
691 lines

ehttp: a minimal Rust HTTP client for both native and WASM

Latest version Documentation unsafe forbidden Build Status MIT Apache

If you want to do HTTP requests and are targeting both native and web (WASM), 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:

There is also a streaming version under ehttp::fetch::streaming, hidden behind the streaming feature flag.

Dependencies

~0.2–3.5MB
~68K SLoC