Skip to content

Commit 6459249

Browse files
committed
- initialize HttpClientFactory in constructor
- raise exception if no HttpClientFactory in FirebaseApp
1 parent e03cfd2 commit 6459249

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

FirebaseAdmin/FirebaseAdmin/AppOptions.cs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ namespace FirebaseAdmin
2626
/// </summary>
2727
public sealed class AppOptions
2828
{
29-
private HttpClientFactory httpClientFactory;
30-
3129
/// <summary>
3230
/// Initializes a new instance of the <see cref="AppOptions"/> class.
3331
/// </summary>
34-
public AppOptions() { }
32+
public AppOptions()
33+
{
34+
this.HttpClientFactory = new HttpClientFactory();
35+
}
3536

3637
internal AppOptions(AppOptions options)
3738
{
@@ -66,24 +67,6 @@ internal AppOptions(AppOptions options)
6667
/// <summary>
6768
/// Gets or sets the HttpClientFactory to use when making Firebase requests.
6869
/// </summary>
69-
public HttpClientFactory HttpClientFactory
70-
{
71-
get
72-
{
73-
if (this.httpClientFactory != null)
74-
{
75-
return this.httpClientFactory;
76-
}
77-
else
78-
{
79-
return new HttpClientFactory();
80-
}
81-
}
82-
83-
set
84-
{
85-
this.httpClientFactory = value;
86-
}
87-
}
70+
public HttpClientFactory HttpClientFactory { get; set; }
8871
}
8972
}

FirebaseAdmin/FirebaseAdmin/FirebaseApp.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ private FirebaseApp(AppOptions options, string name)
7878
this.options.Credential = this.options.Credential.CreateScoped(DefaultScopes);
7979
}
8080

81+
if (this.options.HttpClientFactory == null)
82+
{
83+
throw new ArgumentNullException("HttpClientFactory must be set");
84+
}
85+
8186
this.Name = name;
8287
}
8388

0 commit comments

Comments
 (0)