pub trait HttpClient: Send + Sync {
// Required method
fn get_text<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<(StatusCode, Bytes), SpiderError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
A simple HTTP client trait for fetching web content.
Required Methods§
Sourcefn get_text<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<(StatusCode, Bytes), SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_text<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<(StatusCode, Bytes), SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Fetches the content of a URL as text.
§Errors
Returns an error when the request fails, times out, or the response body cannot be read.