1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

Merge pull request #14 from mbrobbel/fix-typos

Fix typos
This commit is contained in:
Nikolay Kim 2018-05-30 10:19:30 -07:00 committed by GitHub
commit e8582c14cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 .map_err(Error::from) // <- convert SendRequestError to an Error
.and_then( .and_then(
|resp| resp.body() // <- this is MessageBody type, resolves to complete body |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| { .and_then(|body| {
let resp: HttpBinResponse = serde_json::from_slice(&body).unwrap(); let resp: HttpBinResponse = serde_json::from_slice(&body).unwrap();
fut_ok(resp.json) 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 .map_err(Error::from) // <- convert SendRequestError to an Error
.and_then( .and_then(
|resp| resp.body() // <- this is MessageBody type, resolves to complete body |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| { .and_then(|body| {
let resp: HttpBinResponse = serde_json::from_slice(&body).unwrap(); let resp: HttpBinResponse = serde_json::from_slice(&body).unwrap();
fut_ok(resp.json) 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 .map_err(Error::from) // <- convert SendRequestError to an Error
.and_then( .and_then(
|resp| resp.body() // <- this is MessageBody type, resolves to complete body |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 .and_then(|body| { // <- we got complete body, now send as server response
Ok(HttpResponse::Ok().body(body)) 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 .and_then(|resp| { // <- we received client response
Ok(HttpResponse::Ok() Ok(HttpResponse::Ok()
// read one chunk from client response and send this chunk to a server response // 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())))) .body(Body::Streaming(Box::new(resp.from_err()))))
}) })
.responder() .responder()