mirror of
https://github.com/actix/actix-website
synced 2025-02-21 11:54:48 +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> {
|
async fn index(mut body: web::Payload) -> Result<HttpResponse, Error> {
|
||||||
let mut bytes = web::BytesMut::new();
|
let mut bytes = web::BytesMut::new();
|
||||||
while let Some(item) = body.next().await {
|
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())
|
Ok(HttpResponse::Ok().finish())
|
||||||
}
|
}
|
||||||
// </streaming>
|
// </streaming>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user