mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
add test for head with jsonpatch merge strategy
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user