diff --git a/src/main/java/com/bakdata/kserve/client/KServeClient.java b/src/main/java/com/bakdata/kserve/client/KServeClient.java index 0a0f88b..9f932b0 100644 --- a/src/main/java/com/bakdata/kserve/client/KServeClient.java +++ b/src/main/java/com/bakdata/kserve/client/KServeClient.java @@ -100,7 +100,9 @@ private static ObjectMapper createObjectMapper() { } private static String getStringBody(final Response response) throws IOException { - return response.body().string(); + try (ResponseBody body = response.body()) { + return body.string(); + } } private static Optional processJsonResponse(final String stringBody, final Class responseType) {