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

#168 in Network programming

Download history 9954/week @ 2024-06-30 8076/week @ 2024-07-07 9746/week @ 2024-07-14 7613/week @ 2024-07-21 7677/week @ 2024-07-28 7910/week @ 2024-08-04 9540/week @ 2024-08-11 7528/week @ 2024-08-18 11727/week @ 2024-08-25 10026/week @ 2024-09-01 9923/week @ 2024-09-08 9529/week @ 2024-09-15 10868/week @ 2024-09-22 10717/week @ 2024-09-29 11536/week @ 2024-10-06 11499/week @ 2024-10-13

45,166 downloads per month
Used in 57 crates (20 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
~67K SLoC