Skip to content

Commit 25869d1

Browse files
committed
Don't overwrite a custom set HttpClientFactory
An end-user, or unit tests, should be able to set a custom HttpClientFactory and not have OpenStackNet.Configure() nuke it.
1 parent 9ff6bc7 commit 25869d1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/corelib/OpenStackNet.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@ public static void Configure(Action<FlurlHttpConfigurationOptions> configureFlur
6060

6161
FlurlHttp.Configure(c =>
6262
{
63-
// Apply our default settings
64-
c.HttpClientFactory = new AuthenticatedHttpClientFactory();
65-
6663
// Apply the application's default settings
6764
if (configureFlurl != null)
6865
configureFlurl(c);
6966

67+
//
68+
// Apply our default settings
69+
//
70+
if(c.HttpClientFactory is DefaultHttpClientFactory)
71+
c.HttpClientFactory = new AuthenticatedHttpClientFactory();
72+
7073
// Apply our event handling without clobbering any application level handlers
7174
var applicationBeforeCall = c.BeforeCall;
7275
c.BeforeCall = call =>

0 commit comments

Comments
 (0)