Skip to content

Commit 3164e92

Browse files
authored
introduce CreateWatchHandle for use with HttpClientFactory (#379)
1 parent 4e1c9bd commit 3164e92

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/httpClientFactory/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public static async Task Main(string[] args)
3232
serviceProvider.GetRequiredService<KubernetesClientConfiguration>(),
3333
httpClient);
3434
})
35-
.ConfigurePrimaryHttpMessageHandler(config.CreateDefaultHttpClientHandler);
35+
.ConfigurePrimaryHttpMessageHandler(config.CreateDefaultHttpClientHandler)
36+
.AddHttpMessageHandler(KubernetesClientConfiguration.CreateWatchHandler);
3637

3738
// Add the class that uses the client
3839
services.AddHostedService<PodListHostedService>();

src/KubernetesClient/KubernetesClientConfiguration.HttpClientHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public HttpClientHandler CreateDefaultHttpClientHandler() {
1414
{
1515
if(this.SkipTlsVerify)
1616
{
17-
httpClientHandler.ServerCertificateCustomValidationCallback =
17+
httpClientHandler.ServerCertificateCustomValidationCallback =
1818
(sender, certificate, chain, sslPolicyErrors) => true;
1919
}
2020
else
@@ -47,5 +47,7 @@ public void AddCertificates(HttpClientHandler handler) {
4747
#endif
4848
}
4949
}
50+
51+
public static DelegatingHandler CreateWatchHandler() => new WatcherDelegatingHandler();
5052
}
51-
}
53+
}

0 commit comments

Comments
 (0)