Skip to content

Commit

Permalink
example: multipart is wrongly using Buf::chunk (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Jul 27, 2023
1 parent da47391 commit 08ee809
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/multipart.rs
@@ -1,6 +1,6 @@
use bytes::BufMut;
use futures_util::TryStreamExt;
use warp::multipart::FormData;
use warp::Buf;
use warp::Filter;

#[tokio::main]
Expand All @@ -14,8 +14,7 @@ async fn main() {
// field.data() only returns a piece of the content, you should call over it until it replies None
while let Some(content) = field.data().await {
let content = content.unwrap();
let chunk: &[u8] = content.chunk();
bytes.extend_from_slice(chunk);
bytes.put(content);
}
Ok((
field.name().to_string(),
Expand Down

0 comments on commit 08ee809

Please sign in to comment.