Skip to content

Commit 5ef6bda

Browse files
nilsbehlenCopilot
andauthored
Apply suggestion from @Copilot
Co-authored-by: Copilot <[email protected]>
1 parent 125990d commit 5ef6bda

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/java/org/privacyidea/AsyncRequestCallable.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e)
7777
@Override
7878
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException
7979
{
80-
// The body of the response can be in `body()` for success cases or in `errorBody()` for error cases.
81-
// We need to handle both and ensure the body is closed to prevent resource leaks.
80+
// Only response.body() is available in OkHttp; ensure it is closed and consumed only once to prevent resource leaks.
8281
// The body can only be consumed once.
8382
try (ResponseBody responseBody = response.body())
8483
{

0 commit comments

Comments
 (0)