Skip to content

Commit

Permalink
Merge pull request #22 from maximn/client_another_ctor
Browse files Browse the repository at this point in the history
Allow setting both `apache http client` and `test` parameters
  • Loading branch information
thinkingserious authored Oct 31, 2017
2 parents 99c1639 + d186c7f commit 87675ee
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/main/java/com/sendgrid/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,17 @@ public class Client {
* Constructor for using the default CloseableHttpClient.
*/
public Client() {
this.httpClient = HttpClients.createDefault();
this.test = false;
this(false);
}

/**
* Constructor for passing in an httpClient for mocking.
* Constructor for passing in an httpClient.
*
* @param httpClient
* an Apache CloseableHttpClient
*/
public Client(CloseableHttpClient httpClient) {
this.httpClient = httpClient;
this.test = false;
this(httpClient, false);
}

/**
Expand All @@ -75,10 +73,23 @@ public Client(CloseableHttpClient httpClient) {
* is a Bool
*/
public Client(Boolean test) {
this.httpClient = HttpClients.createDefault();
this(HttpClients.createDefault(), test);
}

/**
* Constructor for passing in a an httpClient and test parameter to allow for http calls
*
* @param httpClient
* an Apache CloseableHttpClient
* @param test
* is a Bool
*/
public Client(CloseableHttpClient httpClient, Boolean test) {
this.httpClient = httpClient;
this.test = test;
}


/**
* Add query parameters to a URL.
*
Expand Down

0 comments on commit 87675ee

Please sign in to comment.