Expand description
Minimal HTTP client for both native and WASM.
Example:
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
§Feature flags
json— Support json fetchmultipart— Support multipart fetchnative-async— Supportfetch_asyncon nativestreaming— Support streaming fetch
Modules§
- multipart
- Multipart HTTP request for both native and WASM.
- streaming
- Streaming HTTP client for both native and WASM.
Structs§
- Headers
- Headers in a
RequestorResponse. - Partial
Response - An HTTP response status line and headers used for the
streamingAPI. - Request
- A simple HTTP request.
- Response
- Response from a completed HTTP request.
Functions§
- fetch
- Performs an HTTP request and calls the given callback when done.
- fetch_
async - Performs an
asyncHTTP request. - fetch_
blocking - Performs a HTTP request and blocks the thread until it is done.
- headers
Deprecated