mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-25 14:17:14 +00:00
bodyOrNull/respondOrNoContent
This commit is contained in:
1 parent
2cc6126765
commit
ac58b6a7e3
3 files changed
+30
No files matched your search
@@ -0,0 +1,9 @@
|
||||
package dev.inmo.micro_utils.ktor.client
|
||||
|
||||
import io.ktor.client.call.body
|
||||
import io.ktor.client.statement.HttpResponse
|
||||
import io.ktor.http.HttpStatusCode
|
||||
|
||||
suspend inline fun <reified T : Any> HttpResponse.bodyOrNull() = takeIf {
|
||||
status == HttpStatusCode.OK
|
||||
} ?.body<T>()
|
||||
Reference in new issue
Block a user