@@ -173,6 +173,7 @@ struct StreamableHttpClientReconnect<C> {
173173 pub client : C ,
174174 pub session_id : Arc < str > ,
175175 pub uri : Arc < str > ,
176+ pub auth_header : Option < String > ,
176177}
177178
178179impl < C : StreamableHttpClient > SseStreamReconnect for StreamableHttpClientReconnect < C > {
@@ -182,10 +183,11 @@ impl<C: StreamableHttpClient> SseStreamReconnect for StreamableHttpClientReconne
182183 let client = self . client . clone ( ) ;
183184 let uri = self . uri . clone ( ) ;
184185 let session_id = self . session_id . clone ( ) ;
186+ let auth_header = self . auth_header . clone ( ) ;
185187 let last_event_id = last_event_id. map ( |s| s. to_owned ( ) ) ;
186188 Box :: pin ( async move {
187189 client
188- . get_stream ( uri, session_id, last_event_id, None )
190+ . get_stream ( uri, session_id, last_event_id, auth_header )
189191 . await
190192 } )
191193 }
@@ -324,10 +326,12 @@ impl<C: StreamableHttpClient> Worker for StreamableHttpClientWorker<C> {
324326 let client = self . client . clone ( ) ;
325327 let session_id = session_id. clone ( ) ;
326328 let url = config. uri . clone ( ) ;
329+ let auth_header = config. auth_header . clone ( ) ;
327330 tokio:: spawn ( async move {
328331 ct. cancelled ( ) . await ;
329- let delete_session_result =
330- client. delete_session ( url, session_id. clone ( ) , None ) . await ;
332+ let delete_session_result = client
333+ . delete_session ( url, session_id. clone ( ) , auth_header. clone ( ) )
334+ . await ;
331335 match delete_session_result {
332336 Ok ( _) => {
333337 tracing:: info!( session_id = session_id. as_ref( ) , "delete session success" )
@@ -376,7 +380,12 @@ impl<C: StreamableHttpClient> Worker for StreamableHttpClientWorker<C> {
376380 if let Some ( session_id) = & session_id {
377381 match self
378382 . client
379- . get_stream ( config. uri . clone ( ) , session_id. clone ( ) , None , None )
383+ . get_stream (
384+ config. uri . clone ( ) ,
385+ session_id. clone ( ) ,
386+ None ,
387+ config. auth_header . clone ( ) ,
388+ )
380389 . await
381390 {
382391 Ok ( stream) => {
@@ -386,6 +395,7 @@ impl<C: StreamableHttpClient> Worker for StreamableHttpClientWorker<C> {
386395 client : self . client . clone ( ) ,
387396 session_id : session_id. clone ( ) ,
388397 uri : config. uri . clone ( ) ,
398+ auth_header : config. auth_header . clone ( ) ,
389399 } ,
390400 self . config . retry_config . clone ( ) ,
391401 ) ;
@@ -468,6 +478,7 @@ impl<C: StreamableHttpClient> Worker for StreamableHttpClientWorker<C> {
468478 client : self . client . clone ( ) ,
469479 session_id : session_id. clone ( ) ,
470480 uri : config. uri . clone ( ) ,
481+ auth_header : config. auth_header . clone ( ) ,
471482 } ,
472483 self . config . retry_config . clone ( ) ,
473484 ) ;
@@ -704,7 +715,7 @@ impl StreamableHttpClientTransportConfig {
704715 ///
705716 /// # Arguments
706717 ///
707- /// * `value` - The value to set
718+ /// * `value` - A bearer token without the `Bearer ` prefix
708719 pub fn auth_header < T : Into < String > > ( mut self , value : T ) -> Self {
709720 // set our authorization header
710721 self . auth_header = Some ( value. into ( ) ) ;
0 commit comments