aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/lib.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-08-29 11:32:42 +0200
committerAlex Auvolat <alex@adnab.me>2023-08-29 11:32:42 +0200
commit2e90e1c124ea298de5e613de5a672f7c90ab6704 (patch)
tree76d1b50c353048d36e01ffcc8dda2223c0c4545d /src/garage/tests/lib.rs
parent8ef42c9609bcefc642cc9739acb921dffba49b89 (diff)
parent32e5686ad8354a2b2b37807ba6d7add73a6d23ee (diff)
downloadgarage-2e90e1c124ea298de5e613de5a672f7c90ab6704.tar.gz
garage-2e90e1c124ea298de5e613de5a672f7c90ab6704.zip
Merge branch 'main' into nextv0.9.0-beta1
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
+}