Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient:
    Send
    + Sync
    + Clone {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn post<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
        body: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<u16, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(u16, Vec<u8>), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstraction over HTTP client for RAP tool invocation and toolset discovery.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Error type returned by HTTP operations.

Required Methods§

Source

fn post<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, body: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<u16, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

POST a JSON body to the given URL. Returns the HTTP status code.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(u16, Vec<u8>), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

GET the given URL. Returns the HTTP status code and response body.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§