diff --git a/axum-core/CHANGELOG.md b/axum-core/CHANGELOG.md index e5cbe6c2..a0337250 100644 --- a/axum-core/CHANGELOG.md +++ b/axum-core/CHANGELOG.md @@ -14,9 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **changed:** `impl IntoResponse for ()` (which gets called by `impl IntoResponse for HeaderMap`, `impl IntoResponse for Extensions` and others) now returns a body of unknown size. +- **fixed:** Make the `BytesMut` extractor ignore non-data frames from custom + request bodies, matching the `Bytes` extractor ([#3811]) [#3721]: https://github.com/tokio-rs/axum/pull/3721 [#3742]: https://github.com/tokio-rs/axum/pull/3742 +[#3811]: https://github.com/tokio-rs/axum/pull/3811 # 0.5.6 diff --git a/axum-core/src/extract/request_parts.rs b/axum-core/src/extract/request_parts.rs index 5f09dde2..48df1fa1 100644 --- a/axum-core/src/extract/request_parts.rs +++ b/axum-core/src/extract/request_parts.rs @@ -89,7 +89,8 @@ async fn body_to_bytes_mut(body: &mut Body, bytes: &mut BytesMut) -> Result<(), .map_err(FailedToBufferBody::from_err)? { let Ok(data) = frame.into_data() else { - return Ok(()); + // Match `Bytes` by ignoring non-data frames until the body ends. + continue; }; bytes.put(data); }