File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,11 @@ impl<State> Request<State> {
313
313
pub fn len ( & self ) -> Option < usize > {
314
314
self . request . len ( )
315
315
}
316
+ /// Checks if the body is empty.
317
+ #[ must_use]
318
+ pub fn is_empty ( & self ) -> Option < bool > {
319
+ Some ( self . request . len ( ) ? == 0 )
320
+ }
316
321
}
317
322
318
323
impl < State > AsMut < http:: Request > for Request < State > {
Original file line number Diff line number Diff line change @@ -91,6 +91,12 @@ impl Response {
91
91
self . res . len ( )
92
92
}
93
93
94
+ /// Checks if the body is empty.
95
+ #[ must_use]
96
+ pub fn is_empty ( & self ) -> Option < bool > {
97
+ Some ( self . res . len ( ) ? == 0 )
98
+ }
99
+
94
100
/// Get an HTTP header.
95
101
#[ must_use]
96
102
pub fn header ( & self , name : & HeaderName ) -> Option < & Vec < HeaderValue > > {
You can’t perform that action at this time.
0 commit comments