pub trait HttpClient: Send + Sync {
// Required methods
fn get(
&self,
url: &str,
params: &[(&str, &str)],
) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>;
fn post_form(
&self,
url: &str,
params: &[(&str, &str)],
) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>;
fn get_with_auth(
&self,
url: &str,
token: &str,
range: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>;
}Expand description
HTTP client trait enabling deterministic testing via mock implementations.
Uses boxed futures instead of async fn to remain object-safe for dyn dispatch.
Required Methods§
Sourcefn get(
&self,
url: &str,
params: &[(&str, &str)],
) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>
fn get( &self, url: &str, params: &[(&str, &str)], ) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>
Sourcefn post_form(
&self,
url: &str,
params: &[(&str, &str)],
) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>
fn post_form( &self, url: &str, params: &[(&str, &str)], ) -> Pin<Box<dyn Future<Output = Result<Response, QobuzApiError>> + Send + '_>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".