diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt index f9a8a52..c1d3005 100644 --- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt +++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt @@ -254,13 +254,13 @@ open class PinboardPoster() { }.build() val request = Request.Builder().url(httpUrl).build() - val result = client.newCall(request).execute() - - result.body?.string()?.let { response -> - if (response.contains("done")) { - return true - } else { - parseMethodResponse(method, response) + client.newCall(request).execute().use { result -> + result.body?.string()?.let { response -> + if (response.contains("done")) { + return true + } else { + parseMethodResponse(method, response) + } } } } else {