From 46732c94d4480b4fb5f4af90508712684bf33e10 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 27 Jul 2023 16:14:20 -0400 Subject: [PATCH] example: multipart is wrongly using Buf::chunk --- examples/multipart.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/multipart.rs b/examples/multipart.rs index 43215b165..e28dd01de 100644 --- a/examples/multipart.rs +++ b/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] @@ -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(),