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