Skip to content

Commit f049401

Browse files
Merge pull request #36 from sendgrid/response_fix
No longer throwing IOExceptions on non 2xx response codes.
2 parents 8a6e55c + 951576c commit f049401

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ gradle.properties
1616
.gradle
1717
repo/
1818

19+
# VSCode IDE
20+
.vscode
21+
1922
# JetBrains IDEs
2023
*.iml
2124
**/.idea/

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,7 @@ private Response executeApiCall(HttpRequestBase httpPost) throws IOException {
298298
try {
299299
CloseableHttpResponse serverResponse = httpClient.execute(httpPost);
300300
try {
301-
Response response = getResponse(serverResponse);
302-
if(response.getStatusCode() >= 300) {
303-
//throwing IOException here to not break API behavior.
304-
throw new IOException("Request returned status Code "+response.getStatusCode()+"Body:"+response.getBody());
305-
}
306-
return response;
301+
return getResponse(serverResponse);
307302
} finally {
308303
serverResponse.close();
309304
}

0 commit comments

Comments
 (0)