Crates.io | httpc |
lib.rs | httpc |
version | 0.1.2 |
source | src |
created_at | 2021-03-14 22:27:31.321599 |
updated_at | 2022-02-18 16:53:31.194681 |
description | An HTTP client working both natively and in WASM environments. |
homepage | https://github.com/d-e-s-o/httpc |
repository | |
max_upload_size | |
id | 368916 |
size | 69,178 |
httpc is a Rust library crate providing an HTTP client that works
both natively as well as in a bare bones WASM environment as used in
web browsers. That is to say, the client code looks exactly the same and
all that is needed to switch between the two is to compile for a
different target platform (wasm32-unknown-unknown
).
When compiling natively, the crate relies on hyper
as the
underlying HTTP client. When targeting WASM it works directly with the
Fetch API as exposed through web-sys
.
The crate does not yet provide functionality for all potential HTTP client use cases, though that is mostly a matter of implementing it: the interface should be able to cater to most use cases.
One of the main pain points of making HTTP requests in a certain application from a WASM environment is arguably testing it properly. httpc comes with a test suite covering supported functionality and it includes all the necessary setup code to make it run both natively as well as when targeting WASM.