From 0b3bce5bc2b88a0eb3a6bc894804d564e4723638 Mon Sep 17 00:00:00 2001 From: davotoula Date: Sun, 29 Mar 2026 15:13:43 +0200 Subject: [PATCH] fixes for sonar --- .../model/nip86RelayManagement/Nip86Retriever.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip86RelayManagement/Nip86Retriever.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip86RelayManagement/Nip86Retriever.kt index a4a3a6cfa..306dc530a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip86RelayManagement/Nip86Retriever.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip86RelayManagement/Nip86Retriever.kt @@ -34,13 +34,12 @@ import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.coroutines.executeAsync +private const val CONTENT_TYPE_STRING = "application/nostr+json+rpc" +private val CONTENT_TYPE = CONTENT_TYPE_STRING.toMediaType() + class Nip86Retriever( val okHttpClient: (NormalizedRelayUrl) -> OkHttpClient, ) { - companion object { - val CONTENT_TYPE = "application/nostr+json+rpc".toMediaType() - } - suspend fun execute( client: Nip86Client, request: Nip86Request, @@ -53,8 +52,8 @@ class Nip86Retriever( Request .Builder() .url(client.httpUrl) - .header("Content-Type", "application/nostr+json+rpc") - .header("Accept", "application/nostr+json+rpc") + .header("Content-Type", CONTENT_TYPE_STRING) + .header("Accept", CONTENT_TYPE_STRING) .header("Authorization", authToken) .post(bodyBytes.toRequestBody(CONTENT_TYPE)) .build()