1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-26 19:41:12 +00:00
actix-web/awc/README.md

37 lines
1.2 KiB
Markdown
Raw Normal View History

2020-10-30 02:50:53 +00:00
# awc (Actix Web Client)
2019-04-16 17:49:38 +00:00
2020-10-30 02:50:53 +00:00
> Async HTTP and WebSocket client library.
2019-04-16 17:49:38 +00:00
2020-10-30 02:50:53 +00:00
[![crates.io](https://img.shields.io/crates/v/awc?label=latest)](https://crates.io/crates/awc)
2021-12-11 00:28:38 +00:00
[![Documentation](https://docs.rs/awc/badge.svg?version=3.0.0-beta.13)](https://docs.rs/awc/3.0.0-beta.13)
2021-02-10 12:10:03 +00:00
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/awc)
2021-12-11 00:28:38 +00:00
[![Dependency Status](https://deps.rs/crate/awc/3.0.0-beta.13/status.svg)](https://deps.rs/crate/awc/3.0.0-beta.13)
2021-06-26 15:33:36 +00:00
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
2019-04-16 17:49:38 +00:00
2020-10-30 02:50:53 +00:00
## Documentation & Resources
2020-11-25 00:07:56 +00:00
- [API Documentation](https://docs.rs/awc)
- [Example Project](https://github.com/actix/examples/tree/HEAD/security/awc_https)
2021-10-19 00:59:28 +00:00
- Minimum Supported Rust Version (MSRV): 1.52
2019-04-16 17:49:38 +00:00
## Example
2019-04-16 17:49:38 +00:00
```rust
use actix_rt::System;
use awc::Client;
fn main() {
System::new().block_on(async {
let client = Client::default();
let res = client
.get("http://www.rust-lang.org") // <- Create request builder
2021-03-15 10:59:42 +00:00
.insert_header(("User-Agent", "Actix-web"))
.send() // <- Send http request
.await;
println!("Response: {:?}", res); // <- server http response
});
2019-04-16 17:49:38 +00:00
}
```