Development
Many features require an unstable Rust feature – return type notation. The main crate areq has the rtn feature, which enables the missing functionality. High-level crates areq-smol and areq-tokio require this feature for compilation, so to use the library you need to install nightly compiler. Once the RTN feature is stabilized, the library will be usable on stable.
Features
- Async only, no hidden overhead from blocking API
- Independent of any async runtime, including features. Instead, the runtime extends the functionality of the base crate
- Zero-cost abstractions for a flexible solution and an ability to choose a simple API when needed
- Modular and configurable – build exactly the HTTP client you need
Getting Started
Although the library is runtime-independent, it also provides high-level crates for choosing a specific runtime. Currently, two crates are available:
areq-smolprovides support for the smol runtimeareq-tokioprovides support for the tokio runtime
As an example, let's use tokio and add the crate to a project. You also need to select an HTTP protocol version that the client will support. For this example, let's use HTTP/1.1 which can be enabled with the http1 cargo feature:
Now you can make a GET request and read a response body:
use ;
async