1
0
mirror of https://github.com/actix/actix-website synced 2025-02-17 10:13:31 +01:00

Merge pull request #161 from danielzfranklin/master

Fix logic bug in streaming request example
This commit is contained in:
Yuki Okushi 2020-03-02 11:15:20 +09:00 committed by GitHub
commit a784af8010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,11 @@ use futures::StreamExt;
async fn index(mut body: web::Payload) -> Result<HttpResponse, Error> {
let mut bytes = web::BytesMut::new();
while let Some(item) = body.next().await {
bytes.extend_from_slice(&item?);
let item = item?;
println!("Chunk: {:?}", &item);
bytes.extend_from_slice(&item);
}
println!("Chunk: {:?}", bytes);
Ok(HttpResponse::Ok().finish())
}
// </streaming>