Skip to content

Commit 2936eb7

Browse files
committed
Add doctest example to Command::has_body()
1 parent c86795c commit 2936eb7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

s3/src/command.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,22 @@ impl<'a> Command<'a> {
233233
/// stray `Content-Length: 0` / `Content-Type: text/plain` headers do
234234
/// not enter the AWS4-HMAC-SHA256 canonical request, which Cloudflare
235235
/// R2 rejects as a signature mismatch (notably for ranged `GET`s).
236+
///
237+
/// # Examples
238+
///
239+
/// ```
240+
/// use s3::command::Command;
241+
///
242+
/// assert!(Command::PutObject {
243+
/// content: b"hi",
244+
/// content_type: "text/plain",
245+
/// custom_headers: None,
246+
/// multipart: None,
247+
/// }
248+
/// .has_body());
249+
/// assert!(!Command::GetObject.has_body());
250+
/// assert!(!Command::GetObjectRange { start: 0, end: Some(1023) }.has_body());
251+
/// ```
236252
pub fn has_body(&self) -> bool {
237253
matches!(
238254
self,

0 commit comments

Comments
 (0)