1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00

Fix typos

This commit is contained in:
Matthijs Brobbel 2018-05-30 12:05:23 +02:00
parent 4d41d40da2
commit c1b432cb97
No known key found for this signature in database
GPG Key ID: 551189F8515034D3
2 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ fn step_x_v1(data: SomeData) -> Box<Future<Item = SomeData, Error = Error>> {
.map_err(Error::from) // <- convert SendRequestError to an Error
.and_then(
|resp| resp.body() // <- this is MessageBody type, resolves to complete body
.from_err() // <- convert PayloadError to a Error
.from_err() // <- convert PayloadError to an Error
.and_then(|body| {
let resp: HttpBinResponse = serde_json::from_slice(&body).unwrap();
fut_ok(resp.json)
@ -109,7 +109,7 @@ fn step_x_v2(data: SomeData) -> impl Future<Item = SomeData, Error = Error> {
.map_err(Error::from) // <- convert SendRequestError to an Error
.and_then(
|resp| resp.body() // <- this is MessageBody type, resolves to complete body
.from_err() // <- convert PayloadError to a Error
.from_err() // <- convert PayloadError to an Error
.and_then(|body| {
let resp: HttpBinResponse = serde_json::from_slice(&body).unwrap();
fut_ok(resp.json)

View File

@ -17,7 +17,7 @@ fn index(_req: HttpRequest) -> Box<Future<Item = HttpResponse, Error = Error>> {
.map_err(Error::from) // <- convert SendRequestError to an Error
.and_then(
|resp| resp.body() // <- this is MessageBody type, resolves to complete body
.from_err() // <- convert PayloadError to a Error
.from_err() // <- convert PayloadError to an Error
.and_then(|body| { // <- we got complete body, now send as server response
Ok(HttpResponse::Ok().body(body))
}))
@ -34,7 +34,7 @@ fn streaming(_req: HttpRequest) -> Box<Future<Item = HttpResponse, Error = Error
.and_then(|resp| { // <- we received client response
Ok(HttpResponse::Ok()
// read one chunk from client response and send this chunk to a server response
// .from_err() converts PayloadError to a Error
// .from_err() converts PayloadError to an Error
.body(Body::Streaming(Box::new(resp.from_err()))))
})
.responder()