Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient: Send + Sync {
    // Required methods
    fn get(&self, url: &str) -> Result<HttpResponse>;
    fn head(&self, url: &str) -> Result<HttpResponse>;
    fn get_range(&self, url: &str, start: u64, end: u64) -> Result<HttpResponse>;
}
Expand description

Trait for HTTP client operations.

This trait abstracts HTTP operations to allow for testing with mock implementations. The real implementation uses reqwest, while tests can use MockHttpClient.

Required Methods§

Source

fn get(&self, url: &str) -> Result<HttpResponse>

Performs an HTTP GET request.

Source

fn head(&self, url: &str) -> Result<HttpResponse>

Performs an HTTP HEAD request.

Source

fn get_range(&self, url: &str, start: u64, end: u64) -> Result<HttpResponse>

Performs an HTTP GET request with a Range header.

Implementors§