pub trait HttpPoster: Send + Sync {
// Required method
fn post<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpReply>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn timeout_hint(&self) -> Option<Duration> { ... }
}Available on crate feature
mcp only.Expand description
Abstraction over the act of POSTing one JSON-RPC message to the MCP endpoint.
Production uses ReqwestPoster; tests inject a scripted poster so the
JSON / SSE decode paths run with zero live network.
Required Methods§
Sourcefn post<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpReply>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn post<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
) -> Pin<Box<dyn Future<Output = Result<HttpReply>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
POST request to the MCP endpoint and return the normalised reply.
§Errors
Returns an error if the HTTP request fails or the server returns a non-success status.
Provided Methods§
Sourcefn timeout_hint(&self) -> Option<Duration>
fn timeout_hint(&self) -> Option<Duration>
The poster’s own per-request timeout, when it knows it.
StreamableHttpTransport::with_request_timeout uses this to warn
when a caller raises the send deadline past the poster’s internal
timeout (the raise would silently never take effect). Default None
means “unknown” and disables the check.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".