mirror of
https://github.com/HighCapable/SweetProperty.git
synced 2025-09-03 17:25:43 +08:00
refactor: some tweaks in HttpFactory
This commit is contained in:
@@ -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() ?: ""
|
Reference in New Issue
Block a user