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:
commit
a784af8010
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user