mirror of https://github.com/fafhrd91/actix-web
commit
c227fa9654
|
@ -1,8 +1,15 @@
|
||||||
blank_issues_enabled: true
|
blank_issues_enabled: true
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Gitter channel (actix-web)
|
- name: GitHub Discussions
|
||||||
|
url: https://github.com/actix/actix-web/discussions
|
||||||
|
about: Actix Web Q&A
|
||||||
|
- name: Gitter chat (actix-web)
|
||||||
url: https://gitter.im/actix/actix-web
|
url: https://gitter.im/actix/actix-web
|
||||||
about: Please ask and answer questions about the actix-web here.
|
about: Actix Web Q&A
|
||||||
- name: Gitter channel (actix)
|
- name: Gitter chat (actix)
|
||||||
url: https://gitter.im/actix/actix
|
url: https://gitter.im/actix/actix
|
||||||
about: Please ask and answer questions about the actix here.
|
about: Actix (actor framework) Q&A
|
||||||
|
- name: Actix Discord
|
||||||
|
url: https://discord.gg/NWpN5mmg3x
|
||||||
|
about: Actix developer discussion and community chat
|
||||||
|
|
||||||
|
|
|
@ -16,23 +16,21 @@
|
||||||
- Minimum Supported Rust Version (MSRV): 1.42.0
|
- Minimum Supported Rust Version (MSRV): 1.42.0
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use actix_rt::System;
|
use actix_rt::System;
|
||||||
use awc::Client;
|
use awc::Client;
|
||||||
use futures::future::{Future, lazy};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
System::new("test").block_on(lazy(|| {
|
System::new("test").block_on(async {
|
||||||
let mut client = Client::default();
|
let client = Client::default();
|
||||||
|
|
||||||
client.get("http://www.rust-lang.org") // <- Create request builder
|
let res = client
|
||||||
.header("User-Agent", "Actix-web")
|
.get("http://www.rust-lang.org") // <- Create request builder
|
||||||
.send() // <- Send http request
|
.header("User-Agent", "Actix-web")
|
||||||
.and_then(|response| { // <- server http response
|
.send() // <- Send http request
|
||||||
println!("Response: {:?}", response);
|
.await;
|
||||||
Ok(())
|
|
||||||
})
|
println!("Response: {:?}", res); // <- server http response
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue