pub trait HttpClient: Send + Sync {
// Required methods
fn post<'life0, 'async_trait>(
&'life0 self,
url: String,
body: Vec<u8>,
headers: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'async_trait>(
&'life0 self,
url: String,
headers: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Define uma interface abstrata para clientes HTTP.
Esta trait permite abstrair operações HTTP comuns, tornando mais fácil mock e testar componentes que fazem requisições HTTP.
Required Methods§
Sourcefn post<'life0, 'async_trait>(
&'life0 self,
url: String,
body: Vec<u8>,
headers: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn post<'life0, 'async_trait>(
&'life0 self,
url: String,
body: Vec<u8>,
headers: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Implementors§
impl HttpClient for MockHttpClient
Define uma interface abstrata para clientes HTTP.
Esta trait permite abstrair operações HTTP comuns, tornando mais fácil mock e testar componentes que fazem requisições HTTP.