diff --git a/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt b/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt index 734533a759..cee22ef2b1 100644 --- a/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt +++ b/kotlin-multiplatform/src/commonMain/kotlin/com/ricoh360/thetaclient/ThetaRepository.kt @@ -415,7 +415,19 @@ class ThetaRepository internal constructor(val endpoint: String, config: Config? if (response.status != HttpStatusCode.OK) { throw ThetaWebApiException(response.toString()) } - return response.bodyAsText() + val input = response.body() + val builder = StringBuilder() + try { + while (!input.endOfInput) { + val char = input.readText(1, 1) + builder.append(char) + } + } catch (e: Throwable) { + throw e + } finally { + input.close() + } + return builder.toString() } catch (e: JsonConvertException) { throw ThetaWebApiException(e.message ?: e.toString()) } catch (e: ResponseException) {