Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: multipart is wrongly using Buf::chunk #1055

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/multipart.rs
Original file line number Diff line number Diff line change
@@ -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