HttpClient

Trait HttpClient 

Source
pub trait HttpClient {
    // Required methods
    fn get(
        &self,
        url: &Uri,
    ) -> impl Future<Output = Result<String, String>> + Send + Sized;
    fn post(
        &self,
        url: &Uri,
        body: Value,
    ) -> impl Future<Output = Result<String, String>> + Send + Sized;
}
Expand description

Generic HTTP Client Trait

For discovery, sending shares and notifications a HTTP Client is necessary. By implementing this trait you can use a HTTP Client of your choice for that. Make sure to implement timeouts and caching as appropriate to your application.

⚠️ Note: Currently when implementing this trait you also need to implement http signatures! This might be replace by some hyper based client or service trait in future releases.

Required Methods§

Source

fn get( &self, url: &Uri, ) -> impl Future<Output = Result<String, String>> + Send + Sized

Source

fn post( &self, url: &Uri, body: Value, ) -> impl Future<Output = Result<String, String>> + Send + Sized

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§