Skip to content

Commit

Permalink
improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Jan 17, 2025
1 parent 1c52a38 commit 1020850
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected <T> boolean handleResponseError(
if (response.isSuccessful()) {
return false;
}
try {
try (response) {
if (response.code() == SC_UNSUPPORTED_MEDIA_TYPE) {
futureResponse.complete(Response.fromUnsupportedMediaTypeError());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ void handleResponse(final Request request, final okhttp3.Response response) {
if (handleResponseError(request, response, futureResponse)) {
return;
}
if (response.body() != null) {
response.body().close();
}
response.close();
futureResponse.complete(Response.fromNullPayload());
}

Expand Down

0 comments on commit 1020850

Please sign in to comment.