pub struct HttpClient { /* private fields */ }Expand description
HTTP client for executing OpenAPI requests
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn with_timeout(timeout_seconds: u64) -> Self
pub fn with_timeout(timeout_seconds: u64) -> Self
Sourcepub fn with_insecure(self, insecure: bool) -> Self
pub fn with_insecure(self, insecure: bool) -> Self
Rebuild the underlying reqwest::Client, optionally disabling TLS
certificate and hostname verification.
When insecure is true, both danger_accept_invalid_certs and
danger_accept_invalid_hostnames are enabled to mirror
curl --insecure. The previously configured timeout is preserved.
When insecure is false, this is a no-op: the existing client
is returned unchanged so callers that pass the flag through
unconditionally do not pay for a second reqwest::Client.
This method is one-way: a client previously built with
insecure = true cannot have TLS verification re-enabled by
calling with_insecure(false). To get a strict client, construct
a fresh HttpClient with HttpClient::new.
§Panics
Panics if the HTTP client cannot be created.
Sourcepub fn with_base_url(self, base_url: Url) -> Result<Self, Error>
pub fn with_base_url(self, base_url: Url) -> Result<Self, Error>
Sourcepub fn with_default_headers(self, default_headers: HeaderMap) -> Self
pub fn with_default_headers(self, default_headers: HeaderMap) -> Self
Set default headers for all requests
Create a new HTTP client with authorization header
Clones the current client and adds the Authorization header to default headers. This allows passing authorization through to backend APIs.
Sourcepub async fn execute_tool_call(
&self,
tool_metadata: &ToolMetadata,
arguments: &Value,
) -> Result<HttpResponse, ToolCallError>
pub async fn execute_tool_call( &self, tool_metadata: &ToolMetadata, arguments: &Value, ) -> Result<HttpResponse, ToolCallError>
Execute an OpenAPI tool call
§Errors
Returns an error if the HTTP request fails or parameters are invalid