@@ -58,7 +58,10 @@ public SseClientTransport(SseClientTransportOptions transportOptions, HttpClient
5858 /// <param name="transportOptions">Configuration options for the transport.</param>
5959 /// <param name="authorizationProvider">The authorization provider to use for authentication.</param>
6060 /// <param name="loggerFactory">Logger factory for creating loggers used for diagnostic output during transport operations.</param>
61- public SseClientTransport ( SseClientTransportOptions transportOptions , ITokenProvider authorizationProvider , ILoggerFactory ? loggerFactory = null )
61+ /// <param name="baseMessageHandler">Optional. The base message handler to use under the authorization handler.
62+ /// If null, a new <see cref="HttpClientHandler"/> will be used. This allows for custom HTTP client pipelines (e.g., from HttpClientFactory)
63+ /// to be used in conjunction with the token-based authentication provided by <paramref name="authorizationProvider"/>.</param>
64+ public SseClientTransport ( SseClientTransportOptions transportOptions , ITokenProvider authorizationProvider , ILoggerFactory ? loggerFactory = null , HttpMessageHandler ? baseMessageHandler = null )
6265 {
6366 Throw . IfNull ( transportOptions ) ;
6467 Throw . IfNull ( authorizationProvider ) ;
@@ -67,13 +70,11 @@ public SseClientTransport(SseClientTransportOptions transportOptions, ITokenProv
6770 _loggerFactory = loggerFactory ;
6871 Name = transportOptions . Name ?? transportOptions . Endpoint . ToString ( ) ;
6972
70- // Create an auth handler with the authorization provider
7173 var authHandler = new AuthorizationDelegatingHandler ( authorizationProvider )
7274 {
73- InnerHandler = new HttpClientHandler ( )
75+ InnerHandler = baseMessageHandler ?? new HttpClientHandler ( )
7476 } ;
7577
76- // Create an HttpClient with the auth handler
7778 _httpClient = new HttpClient ( authHandler ) ;
7879 _ownsHttpClient = true ;
7980 }
0 commit comments