Skip to content

Commit

Permalink
rm if_none_match with *
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <kemingy94@gmail.com>
  • Loading branch information
kemingy committed Nov 12, 2024
1 parent 1272ff1 commit ce87b81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/types/operator/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ impl Operator {
/// use opendal::Operator;
/// # async fn test(op: Operator, etag: &str) -> Result<()> {
/// let bs = b"hello, world!".to_vec();
/// let res = op.write_with("path/to/file", bs).if_none_match("*").await;
/// let res = op.write_with("path/to/file", bs).if_none_match(etag).await;
/// assert!(res.is_err());
/// assert_eq!(res.unwrap_err().kind(), ErrorKind::ConditionNotMatch);
/// # Ok(())
Expand Down
5 changes: 4 additions & 1 deletion core/tests/behavior/async_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,12 @@ pub async fn test_write_with_if_none_match(op: Operator) -> Result<()> {
op.write(&path, content.clone())
.await
.expect("write must succeed");

let meta = op.stat(&path).await?;

let res = op
.write_with(&path, content.clone())
.if_none_match("*")
.if_none_match(meta.etag().expect("etag must exist"))
.await;
assert!(res.is_err());
assert_eq!(res.unwrap_err().kind(), ErrorKind::ConditionNotMatch);
Expand Down

0 comments on commit ce87b81

Please sign in to comment.