aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/lib.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-08-28 12:32:57 +0200
committerAlex Auvolat <alex@adnab.me>2023-08-28 12:32:57 +0200
commite66c78d6eaeb01b64911013b3a36d798c561acb8 (patch)
tree1c142acc9b25ead49e14af35660497964463bf43 /src/garage/tests/lib.rs
parent51011e68b16efc2232606bee47fcdc9e8a11068e (diff)
downloadgarage-e66c78d6eaeb01b64911013b3a36d798c561acb8.tar.gz
garage-e66c78d6eaeb01b64911013b3a36d798c561acb8.zip
integration test: move json_body to root of crate
Diffstat (limited to 'src/garage/tests/lib.rs')
-rw-r--r--src/garage/tests/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/garage/tests/lib.rs b/src/garage/tests/lib.rs
index e450baac..ab92bc0a 100644
--- a/src/garage/tests/lib.rs
+++ b/src/garage/tests/lib.rs
@@ -10,3 +10,16 @@ mod s3;
mod k2v;
#[cfg(feature = "k2v")]
mod k2v_client;
+
+use hyper::{Body, Response};
+
+pub async fn json_body(res: Response<Body>) -> serde_json::Value {
+ let res_body: serde_json::Value = serde_json::from_slice(
+ &hyper::body::to_bytes(res.into_body())
+ .await
+ .unwrap()
+ .to_vec()[..],
+ )
+ .unwrap();
+ res_body
+}