}
pub(crate) fn get_json<T: DeserializeOwned>(&self, path: impl AsRef<str>) -> T {
if let Err(error) = self.index.update() {
log::error!("{error}");
}
let client = reqwest::blocking::Client::new();
let response = client
.get(self.join_url(path.as_ref()))
.header(reqwest::header::ACCEPT, "application/json")
.send()
.unwrap();
assert_eq!(response.status(), StatusCode::OK);
response.json().unwrap()
}
fn join_url(&self, url: &str) -> Url {
self.url.join(url).unwrap()
}
fn assert_response(&self, path: impl AsRef<str>, status: StatusCode, expected_response: &str) {
let response = self.get(path);
assert_eq!(response.status(), status, "{}", response.text().unwrap());
pretty_assert_eq!(response.text().unwrap(), expected_response);
}
fn assert_response_regex(
&self,
path: impl AsRef<str>,
status: StatusCode,
regex: impl AsRef<str>,
) {
let response = self.get(path);