From f9212ea404b31ce9b22d2d7b4f1e3e14c0c8cef8 Mon Sep 17 00:00:00 2001 From: Juraj Hrivnak Date: Fri, 23 Feb 2024 14:20:42 +0100 Subject: [PATCH] Print status code only on debug mode --- src/commonMain/kotlin/teksturepako/pakku/api/http/Http.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commonMain/kotlin/teksturepako/pakku/api/http/Http.kt b/src/commonMain/kotlin/teksturepako/pakku/api/http/Http.kt index 7608732d..142c9c07 100644 --- a/src/commonMain/kotlin/teksturepako/pakku/api/http/Http.kt +++ b/src/commonMain/kotlin/teksturepako/pakku/api/http/Http.kt @@ -63,8 +63,8 @@ open class Http suspend inline fun HttpResponse.bodyIfOK(): T? { - return if (this.status == HttpStatusCode.OK) this.body() else null.also { - println("Error: ${this::class.simpleName} HTTP request returned: ${this.status}") + return if (this.status == HttpStatusCode.OK) this.body() else null.debug { + println("Error: ${this@Http::class.simpleName} HTTP request returned: ${this.status}") } } }