mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-28 00:00:20 +02:00
Make RequestParts::body_mut return &mut Option<B> (#869)
This commit is contained in:
@@ -204,8 +204,9 @@ impl<B> RequestParts<B> {
|
||||
/// Gets a mutable reference to the request body.
|
||||
///
|
||||
/// Returns `None` if the body has been taken by another extractor.
|
||||
pub fn body_mut(&mut self) -> Option<&mut B> {
|
||||
self.body.as_mut()
|
||||
// this returns `&mut Option<B>` rather than `Option<&mut B>` such that users can use it to set the body.
|
||||
pub fn body_mut(&mut self) -> &mut Option<B> {
|
||||
&mut self.body
|
||||
}
|
||||
|
||||
/// Takes the body out of the request, leaving a `None` in its place.
|
||||
|
||||
Reference in New Issue
Block a user