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

39 lines
1.4 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)
[![Documentation](https://docs.rs/awc/badge.svg?version=2.0.1)](https://docs.rs/awc/2.0.1)
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/awc)
[![Dependency Status](https://deps.rs/crate/awc/2.0.1/status.svg)](https://deps.rs/crate/awc/2.0.1)
[![Join the chat at https://gitter.im/actix/actix-web](https://badges.gitter.im/actix/actix-web.svg)](https://gitter.im/actix/actix-web?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2019-04-16 17:49:38 +00:00
2020-10-30 02:50:53 +00:00
## Documentation & Resources
- [API Documentation](https://docs.rs/awc/2.0.1)
- [Example Project](https://github.com/actix/examples/tree/HEAD/awc_https)
- [Chat on Gitter](https://gitter.im/actix/actix-web)
- Minimum Supported Rust Version (MSRV): 1.42.0
2019-04-16 17:49:38 +00:00
## Example
```rust
use actix_rt::System;
use awc::Client;
2019-04-16 17:50:37 +00:00
use futures::future::{Future, lazy};
2019-04-16 17:49:38 +00:00
fn main() {
System::new("test").block_on(lazy(|| {
let mut client = Client::default();
client.get("http://www.rust-lang.org") // <- Create request builder
.header("User-Agent", "Actix-web")
.send() // <- Send http request
.and_then(|response| { // <- server http response
println!("Response: {:?}", response);
Ok(())
})
}));
}
```