add test for head with jsonpatch merge strategy

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2025-09-09 15:02:23 +07:00
parent 40dbe40b75
commit 6d8c23beda
+27
View File
@@ -1,3 +1,4 @@
use serde_json::{self as json, json};
use tanu::{
check, check_eq, eyre,
http::{self, Client},
@@ -37,3 +38,29 @@ pub async fn head_known() -> eyre::Result<()> {
Ok(())
}
#[tanu::test]
pub async fn head_known_with_jsonpatch() -> eyre::Result<()> {
let key = random_key();
let payload = json!({ "foo": "bar" });
let http = Client::new();
// create new blob
let res = http
.key_put(&key)
.body(json::to_string(&payload)?)
.header("huly-merge-strategy", "jsonpatch")
.header("content-type", "application/json")
.send()
.await?;
check!(res.status().is_success());
let res = http.key_head(&key).send().await?;
check!(res.status().is_success());
// despite the fact we are not setting content-length
// actix forces it to be returned as 0
check_eq!(Some("0"), res.header("content-length"));
Ok(())
}