From adc4aa7906d22188bdfcffffd2d70f76ca3e97c9 Mon Sep 17 00:00:00 2001 From: davotoula Date: Sun, 7 Sep 2025 20:14:58 +0200 Subject: [PATCH] cleaner code --- .../quartz/nip03Timestamp/ots/http/Request.kt | 10 +++++----- .../quartz/nip03Timestamp/ots/http/Response.kt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Request.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Request.kt index cfc02fa5d..025d4d7c1 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Request.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Request.kt @@ -50,8 +50,8 @@ class Request( try { val httpURLConnection = url.openConnection() as HttpURLConnection - httpURLConnection.setReadTimeout(10000) - httpURLConnection.setConnectTimeout(10000) + httpURLConnection.readTimeout = 10000 + httpURLConnection.connectTimeout = 10000 httpURLConnection.setRequestProperty("User-Agent", "OpenTimestamps Java") httpURLConnection.setRequestProperty("Accept", "application/json") httpURLConnection.setRequestProperty("Accept-Encoding", "gzip") @@ -62,7 +62,7 @@ class Request( if (data != null) { httpURLConnection.setDoOutput(true) - httpURLConnection.setRequestMethod("POST") + httpURLConnection.requestMethod = "POST" httpURLConnection.setRequestProperty( "Content-Length", "" + this.data!!.size.toString(), @@ -72,7 +72,7 @@ class Request( wr.flush() } } else { - httpURLConnection.setRequestMethod("GET") + httpURLConnection.requestMethod = "GET" } httpURLConnection.connect() @@ -84,7 +84,7 @@ class Request( response.status = responseCode response.fromUrl = url.toString() var `is` = httpURLConnection.getInputStream() - if ("gzip" == httpURLConnection.getContentEncoding()) { + if ("gzip" == httpURLConnection.contentEncoding) { `is` = GZIPInputStream(`is`) } response.setStream(`is`) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Response.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Response.kt index 8f50c6a78..403f8bbfc 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Response.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip03Timestamp/ots/http/Response.kt @@ -54,7 +54,7 @@ class Response : Closeable { @get:Throws(IOException::class) val string: String - get() = kotlin.text.String(this.bytes, StandardCharsets.UTF_8) + get() = String(this.bytes, StandardCharsets.UTF_8) @get:Throws(IOException::class) val bytes: ByteArray