gitignore_template_generator/http_client/
api.rs

1use crate::core::ProgramExit;
2pub use crate::http_client::impls::{MockEndpointHttpClient, MockHttpClient, UreqHttpClient};
3
4/// Http client trait to make HTTP calls.
5pub trait HttpClient {
6    /// Make a GET HTTP call to given url.
7    ///
8    /// # Arguments
9    /// * `url` - the url to which to make the HTTP call.
10    ///
11    /// # Returns
12    ///
13    /// A result containing the response body of HTTP call if successful, or
14    /// a [`ProgramExit`] on error (e.g. 4xx, network issues...).
15    fn get(&self, url: &str) -> Result<String, ProgramExit>;
16}