diff --git a/Modio/Client.cs b/Modio/Client.cs index b88500d..c7cb422 100644 --- a/Modio/Client.cs +++ b/Modio/Client.cs @@ -1,4 +1,5 @@ using System; +using System.Net.Http; using System.Threading.Tasks; using Modio.Models; @@ -50,6 +51,13 @@ public Client(Credentials credentials) : this(new Connection(ModioApiUrl, creden public Client(Uri baseUrl, Credentials credentials) : this(new Connection(FixBaseUrl(baseUrl), credentials)) { } + + /// + /// Initializes a new instance of with a custom host, custom , and a custom . + /// + public Client(Uri baseUrl, Credentials credentials, HttpClient httpClient) : this(new Connection(FixBaseUrl(baseUrl), credentials, httpClient)) + { + } private Client(IConnection connection) { diff --git a/Modio/Http/Connection.cs b/Modio/Http/Connection.cs index 5f0289c..635ec1d 100644 --- a/Modio/Http/Connection.cs +++ b/Modio/Http/Connection.cs @@ -24,9 +24,13 @@ internal class Connection : IConnection public Credentials Credentials { get; set; } - public Connection(Uri baseAddress, Credentials credentials) + public Connection(Uri baseAddress, Credentials credentials) : this(baseAddress, credentials, new HttpClient()) { - http = new HttpClient(); + } + + public Connection(Uri baseAddress, Credentials credentials, HttpClient httpClient) + { + http = httpClient; BaseAddress = baseAddress; Credentials = credentials; }