pub trait HttpClient: Send + Sync {
// Required methods
fn post<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: Vec<(&'life2 str, &'life3 str)>,
body: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn post_streaming<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: Vec<(&'life2 str, &'life3 str)>,
body: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<StreamingHttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
}Expand description
Abstraction over HTTP POST requests for LLM API calls.
Enables dependency injection for testing without hitting real HTTP endpoints.
Required Methods§
Sourcefn post<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: Vec<(&'life2 str, &'life3 str)>,
body: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn post<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: Vec<(&'life2 str, &'life3 str)>,
body: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Make a POST request and return status + body
Sourcefn post_streaming<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: Vec<(&'life2 str, &'life3 str)>,
body: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<StreamingHttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn post_streaming<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: Vec<(&'life2 str, &'life3 str)>,
body: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<StreamingHttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Make a POST request and return a streaming response