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

#807 in Network programming

Download history 5354/week @ 2023-11-06 7058/week @ 2023-11-13 5671/week @ 2023-11-20 4902/week @ 2023-11-27 3375/week @ 2023-12-04 4343/week @ 2023-12-11 4415/week @ 2023-12-18 2768/week @ 2023-12-25 4546/week @ 2024-01-01 5697/week @ 2024-01-08 6613/week @ 2024-01-15 7738/week @ 2024-01-22 6346/week @ 2024-01-29 7941/week @ 2024-02-05 7124/week @ 2024-02-12 4861/week @ 2024-02-19

26,580 downloads per month
Used in 45 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