1
0
mirror of https://github.com/actix/examples synced 2025-02-02 09:39:03 +01:00

Merge pull request #104 from henrylee2cn/patch-1

fix(async_ex1): send_json(data) -> send_json(&data)
This commit is contained in:
Nikolay Kim 2019-04-04 11:28:22 -07:00 committed by GitHub
commit fbb3dd2c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,7 +61,7 @@ fn step_x_v1(
Box::new( Box::new(
client client
.post("https://httpbin.org/post") .post("https://httpbin.org/post")
.send_json(data) .send_json(&data)
.map_err(Error::from) // <- convert SendRequestError to an Error .map_err(Error::from) // <- convert SendRequestError to an Error
.and_then(|resp| { .and_then(|resp| {
resp // <- this is MessageBody type, resolves to complete body resp // <- this is MessageBody type, resolves to complete body
@ -108,7 +108,7 @@ fn step_x_v2(
) -> impl Future<Item = SomeData, Error = Error> { ) -> impl Future<Item = SomeData, Error = Error> {
client client
.post("https://httpbin.org/post") .post("https://httpbin.org/post")
.send_json(data) .send_json(&data)
.map_err(Error::from) // <- convert SendRequestError to an Error .map_err(Error::from) // <- convert SendRequestError to an Error
.and_then(|resp| { .and_then(|resp| {
resp.from_err() resp.from_err()