Skip to content

Commit

Permalink
fix: return empty on http error codes, log body. (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboxer23 committed Mar 22, 2024
1 parent 9ee6304 commit 040eb9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.bigboxer23</groupId>
<artifactId>utils</artifactId>
<version>2.0.25</version>
<version>2.0.26</version>

<name>utils</name>
<!-- FIXME change it to the project's website -->
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/bigboxer23/utils/http/OkHttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public static <T> Optional<T> getBody(Response response, Class<T> clazz) {
}
if (!response.isSuccessful()) {
logger.error("request not successful body: " + body.get());
return Optional.empty();
}
try {
return Optional.ofNullable(getMoshi().adapter(clazz).fromJson(body.get()));
Expand Down

0 comments on commit 040eb9d

Please sign in to comment.