Address deprecation
This commit is contained in:
1 parent
3673f6f7f9
commit
c07c663105
2 files changed
+6
-4
No files matched your search
@@ -24,7 +24,9 @@ object MergeInterceptor : Interceptor {
|
||||
notifyScope.launch {
|
||||
synchronized(pendingContinuationMapLock) {
|
||||
// Wake up a pending continuation to continue executing task
|
||||
val successor = pendingContinuationMap[key]?.removeFirstOrNull()?.apply { resume(Unit) { triggerSuccessor(key) } }
|
||||
val successor = pendingContinuationMap[key]?.removeFirstOrNull()?.apply {
|
||||
resume(Unit) { _, _, _ -> triggerSuccessor(key) }
|
||||
}
|
||||
// If no successor, delete this entry from hashmap
|
||||
successor ?: pendingContinuationMap.remove(key)
|
||||
}
|
||||
@@ -48,7 +50,7 @@ object MergeInterceptor : Interceptor {
|
||||
val existPendingContinuations = pendingContinuationMap[key]
|
||||
if (existPendingContinuations == null) {
|
||||
pendingContinuationMap[key] = EMPTY_LIST
|
||||
continuation.resume(Unit) {
|
||||
continuation.resume(Unit) { _, _, _ ->
|
||||
triggerSuccessor(key)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -5,15 +5,15 @@ import io.ktor.client.statement.HttpResponse
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import io.ktor.http.isSuccess
|
||||
import io.ktor.utils.io.charsets.decode
|
||||
import io.ktor.utils.io.core.ByteReadPacket
|
||||
import java.nio.charset.CodingErrorAction
|
||||
import kotlinx.io.Source
|
||||
|
||||
suspend fun HttpResponse.bodyAsUtf8Text(): String {
|
||||
val decoder = Charsets.UTF_8.newDecoder().apply {
|
||||
onMalformedInput(CodingErrorAction.REPLACE)
|
||||
onUnmappableCharacter(CodingErrorAction.REPLACE)
|
||||
}
|
||||
val input = body<ByteReadPacket>()
|
||||
val input = body<Source>()
|
||||
|
||||
return decoder.decode(input)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user