mirror of
https://github.com/HighCapable/SweetProperty.git
synced 2025-09-05 10:15:36 +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")
|
else -> SError.make("Invalid URL: $this")
|
||||||
}).get().build()
|
}).get().build()
|
||||||
).execute().let {
|
).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}")
|
else SError.make("Request failed with code ${it.code}")
|
||||||
}
|
}
|
||||||
}.onFailure { if (isShowFailure) SLog.error("Failed to connect to $this\n$it") }.getOrNull() ?: ""
|
}.onFailure { if (isShowFailure) SLog.error("Failed to connect to $this\n$it") }.getOrNull() ?: ""
|
Reference in New Issue
Block a user