Skip to content

Commit 35e7316

Browse files
authored
feat(http/box): BoxBody::empty() creates an empty body (#3468)
hyper 0.14's body type provides an `empty()` method that can be used to construct an empty request or response body. this commit proposes an equivalent method for `BoxBody`. while it is semantically equivalent to `BoxBody::default()`, it can be helpful to clarify that this constructs an empty body. <https://docs.rs/hyper/0.14.31/hyper/body/struct.Body.html#method.empty> Signed-off-by: katelyn martin <[email protected]>
1 parent ca50d6b commit 35e7316

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

linkerd/http/box/src/body.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ impl BoxBody {
3939
inner: Box::pin(Inner(inner)),
4040
}
4141
}
42+
43+
/// Returns an empty [`BoxBody`].
44+
///
45+
/// This is an alias for [`BoxBody::default()`].
46+
pub fn empty() -> Self {
47+
Self::default()
48+
}
4249
}
4350

4451
impl Body for BoxBody {

0 commit comments

Comments
 (0)