Skip to content

Commit

Permalink
fix: close leaking okhttp response body
Browse files Browse the repository at this point in the history
  • Loading branch information
nickybondarenko committed Feb 17, 2025
1 parent 56852a9 commit c02bb68
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ private fun Response.toResolveFlags(): ResolveResponse {
ignoreUnknownKeys = true
}
}
return ResolveResponse.Resolved(networkJson.decodeFromString(bodyString))
try {
return ResolveResponse.Resolved(networkJson.decodeFromString(bodyString))
} finally {
body.close()
}
} ?: throw ConfidenceError.ParseError("Response body is null", listOf())
}

0 comments on commit c02bb68

Please sign in to comment.