aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/lib.rs
blob: ef370db3a64f1005f4a8079518abb1dfc5aa4629 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#[macro_use]
mod common;

mod admin;
mod bucket;

mod s3;

#[cfg(feature = "k2v")]
mod k2v;
#[cfg(feature = "k2v")]
mod k2v_client;

use http_body_util::BodyExt;
use hyper::{body::Body, Response};

pub async fn json_body<B>(res: Response<B>) -> serde_json::Value
where
	B: Body,
	<B as Body>::Error: std::fmt::Debug,
{
	let body = res.into_body().collect().await.unwrap().to_bytes();
	let res_body: serde_json::Value = serde_json::from_slice(&body).unwrap();
	res_body
}