Skip to main content

alto_client/
utils.rs

1use crate::{Client, Error};
2use commonware_parallel::Strategy;
3
4fn healthy_path(base: String) -> String {
5    format!("{base}/health")
6}
7
8impl<S: Strategy> Client<S> {
9    pub async fn health(&self) -> Result<(), Error> {
10        let result = self
11            .http_client
12            .get(healthy_path(self.uri.clone()))
13            .send()
14            .await
15            .map_err(Error::from)?;
16        if !result.status().is_success() {
17            return Err(Error::Failed(result.status()));
18        }
19        Ok(())
20    }
21}