pub struct StreamableHttpClientTransportConfig {
pub uri: Arc<str>,
pub retry_config: Arc<dyn SseRetryPolicy>,
pub channel_buffer_capacity: usize,
pub allow_stateless: bool,
pub auth_header: Option<String>,
pub custom_headers: HashMap<HeaderName, HeaderValue>,
}Fields§
§uri: Arc<str>§retry_config: Arc<dyn SseRetryPolicy>§channel_buffer_capacity: usize§allow_stateless: boolif true, the transport will not require a session to be established
auth_header: Option<String>The value to send in the authorization header
custom_headers: HashMap<HeaderName, HeaderValue>Custom HTTP headers to include with every request
Implementations§
Source§impl StreamableHttpClientTransportConfig
impl StreamableHttpClientTransportConfig
pub fn with_uri(uri: impl Into<Arc<str>>) -> StreamableHttpClientTransportConfig
Sourcepub fn auth_header<T>(self, value: T) -> StreamableHttpClientTransportConfig
pub fn auth_header<T>(self, value: T) -> StreamableHttpClientTransportConfig
Set the authorization header to send with requests
§Arguments
value- A bearer token without theBearerprefix
Sourcepub fn custom_headers(
self,
custom_headers: HashMap<HeaderName, HeaderValue>,
) -> StreamableHttpClientTransportConfig
pub fn custom_headers( self, custom_headers: HashMap<HeaderName, HeaderValue>, ) -> StreamableHttpClientTransportConfig
Set custom HTTP headers to include with every request
§Arguments
custom_headers- A HashMap of header names to header values
§Example
use std::collections::HashMap;
use http::{HeaderName, HeaderValue};
use rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig;
let mut headers = HashMap::new();
headers.insert(
HeaderName::from_static("x-custom-header"),
HeaderValue::from_static("custom-value")
);
let config = StreamableHttpClientTransportConfig::with_uri("http://localhost:8000")
.custom_headers(headers);Trait Implementations§
Source§impl Clone for StreamableHttpClientTransportConfig
impl Clone for StreamableHttpClientTransportConfig
Source§fn clone(&self) -> StreamableHttpClientTransportConfig
fn clone(&self) -> StreamableHttpClientTransportConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for StreamableHttpClientTransportConfig
impl Default for StreamableHttpClientTransportConfig
Source§fn default() -> StreamableHttpClientTransportConfig
fn default() -> StreamableHttpClientTransportConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StreamableHttpClientTransportConfig
impl !RefUnwindSafe for StreamableHttpClientTransportConfig
impl Send for StreamableHttpClientTransportConfig
impl Sync for StreamableHttpClientTransportConfig
impl Unpin for StreamableHttpClientTransportConfig
impl UnsafeUnpin for StreamableHttpClientTransportConfig
impl !UnwindSafe for StreamableHttpClientTransportConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more