introduce CreateWatchHandle for use with HttpClientFactory (#379)

This commit is contained in:
Nicholas Steicke
2020-04-06 13:57:46 +09:30
committed by GitHub
parent 4e1c9bd20c
commit 3164e9234c
2 changed files with 6 additions and 3 deletions

View File

@@ -32,7 +32,8 @@ namespace httpClientFactory
serviceProvider.GetRequiredService<KubernetesClientConfiguration>(),
httpClient);
})
.ConfigurePrimaryHttpMessageHandler(config.CreateDefaultHttpClientHandler);
.ConfigurePrimaryHttpMessageHandler(config.CreateDefaultHttpClientHandler)
.AddHttpMessageHandler(KubernetesClientConfiguration.CreateWatchHandler);
// Add the class that uses the client
services.AddHostedService<PodListHostedService>();

View File

@@ -14,7 +14,7 @@ namespace k8s
{
if(this.SkipTlsVerify)
{
httpClientHandler.ServerCertificateCustomValidationCallback =
httpClientHandler.ServerCertificateCustomValidationCallback =
(sender, certificate, chain, sslPolicyErrors) => true;
}
else
@@ -47,5 +47,7 @@ namespace k8s
#endif
}
}
public static DelegatingHandler CreateWatchHandler() => new WatcherDelegatingHandler();
}
}
}