refactor: some tweaks in HttpFactory

This commit is contained in:
2025-08-19 13:55:16 +08:00
parent 0ae3f9a748
commit b4fdbe6ad9

View File

@@ -52,7 +52,7 @@ internal fun String.executeUrlBody(username: String = "", password: String = "",
else -> SError.make("Invalid URL: $this")
}).get().build()
).execute().let {
if (it.code == 200 || it.code == 404) it.body?.string() ?: ""
if (it.code == 200 || it.code == 404) it.body.string()
else SError.make("Request failed with code ${it.code}")
}
}.onFailure { if (isShowFailure) SLog.error("Failed to connect to $this\n$it") }.getOrNull() ?: ""