4 releases

0.1.2 Feb 18, 2022
0.1.1 Jun 4, 2021
0.1.0 Apr 25, 2021
0.0.0 Mar 14, 2021

#396 in HTTP client

Download history 5/week @ 2024-02-25 58/week @ 2024-03-31

58 downloads per month

Apache-2.0 OR MIT

22KB
333 lines

pipeline crates.io Docs rustc

httpc

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.

Dependencies

~0.8–15MB
~185K SLoC