File tree 1 file changed +3
-1
lines changed
src/Grpc.Net.ClientFactory
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ private static IHttpClientBuilder AddGrpcHttpClient<
308
308
309
309
services . AddHttpClient ( name ) ;
310
310
311
- // Get PrimaryHandler o we can track whether the user set a value or not.
311
+ // Get PrimaryHandler and store it to compare later. Used to track whether the user set a handler or not.
312
312
// This action comes before registered user actions so the primary handler here will be the one created by the factory.
313
313
HttpMessageHandler ? initialPrimaryHandler = null ;
314
314
services . Configure < HttpClientFactoryOptions > ( name , options =>
@@ -320,6 +320,8 @@ private static IHttpClientBuilder AddGrpcHttpClient<
320
320
{
321
321
options . HttpMessageHandlerBuilderActions . Add ( builder =>
322
322
{
323
+ // If the primary handler is unchanged from what the factory created then replace the handler
324
+ // with one that has settings optimized for a gRPC client.
323
325
if ( builder . PrimaryHandler == initialPrimaryHandler )
324
326
{
325
327
// This will throw in .NET Standard 2.0 with a prompt that a user must set a handler.
You can’t perform that action at this time.
0 commit comments