Skip to content

Commit 60fe45c

Browse files
Version Bump 2.2.0: Can pass test flag to allow for http calls
1 parent 1de0e0a commit 60fe45c

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33

44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [2.2.0] - 2016-06-08
7+
### Added
8+
- Can pass test flag to allow for http calls
9+
610
## [2.1.0] - 2016-06-08
711
### Added
812
- DELETE can now have a request body

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ All updates to this project is documented in our [CHANGELOG](https://github.com/
1616
...
1717
dependencies {
1818
...
19-
compile 'com.sendgrid:java-http-client:2.1.0'
19+
compile 'com.sendgrid:java-http-client:2.2.0'
2020
}
2121
2222
repositories {
@@ -31,15 +31,15 @@ repositories {
3131
<dependency>
3232
<groupId>com.sendgrid</groupId>
3333
<artifactId>java-http-client</artifactId>
34-
<version>2.1.0</version>
34+
<version>2.2.0</version>
3535
</dependency>
3636
```
3737

3838
`mvn install`
3939

4040
## Fat Jar
4141

42-
[Download](http://repo1.maven.org/maven2/com/sendgrid/java-http-client/2.1.0/java-http-client-2.1.0-jar.jar)
42+
[Download](http://repo1.maven.org/maven2/com/sendgrid/java-http-client/2.2.0/java-http-client-2.2.0-jar.jar)
4343

4444
## Dependencies
4545

src/main/java/com/sendgrid/Client.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ public HttpDeleteWithBody(final String uri) {
5656
public class Client {
5757

5858
private CloseableHttpClient httpClient;
59+
private Boolean test;
5960

6061
/**
6162
* Constructor for using the default CloseableHttpClient.
6263
*/
6364
public Client() {
6465
this.httpClient = HttpClients.createDefault();
66+
this.test = false;
6567
}
6668

6769
/**
@@ -71,6 +73,16 @@ public Client() {
7173
*/
7274
public Client(CloseableHttpClient httpClient) {
7375
this.httpClient = httpClient;
76+
this.test = false;
77+
}
78+
79+
/**
80+
* Constructor for passing in a test parameter to allow for http calls
81+
*
82+
* @param test is a Bool
83+
*/
84+
public Client(Boolean test) {
85+
this.test = test;
7486
}
7587

7688
/**
@@ -85,7 +97,12 @@ public URI buildUri(String baseUri, String endpoint, Map<String,String> queryPar
8597
URIBuilder builder = new URIBuilder();
8698
URI uri;
8799

88-
builder.setScheme("https");
100+
if (this.test == true) {
101+
builder.setScheme("http");
102+
} else {
103+
builder.setScheme("https");
104+
}
105+
89106
builder.setHost(baseUri);
90107
builder.setPath(endpoint);
91108
if (queryParams != null) {

0 commit comments

Comments
 (0)