Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/com/force/api/http/Http.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ public static final HttpResponse send(HttpRequest req) {
return new HttpResponse().setResponseCode(code);
} else {
logger.info("Bad response code: {} on request: {} {}", code, req.getMethod(), req.getUrl());
return new HttpResponse().setString(
new String(readResponse(conn.getErrorStream()), "UTF-8")).setResponseCode(code);
HttpResponse response = new HttpResponse().setResponseCode(code);
if (conn.getErrorStream() != null) {
response.setString(new String(readResponse(conn.getErrorStream()), "UTF-8"));
} else {
response.setString(conn.getResponseMessage());
}
return response;
}
} catch (MalformedURLException e) {
throw new RuntimeException(e);
Expand Down