pub trait HttpClient:
Debug
+ Send
+ Sync
+ 'static {
// Required method
fn send<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The HTTP port.
Implementations own connection pooling, timeouts and redirects. They must translate
transport failures into origin_domain::AppError:
- no route, DNS failure, connection refused →
OfflineorNetwork - timeout →
Network - anything else →
Network
They must not turn a non-2xx status into an error; that is the caller’s decision
via HttpResponse::error_for_status, because some statuses are normal.
Required Methods§
fn send<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".