From b4fcb62ab6c970e5bd51f99b76d95801a254da6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=BE=E5=B2=A1=E3=80=80=E4=BE=91=E5=87=9B?= <129148471+LassicYM@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:40:23 +0900 Subject: [PATCH] fixed getThetaLicense error for V. --- .../com/ricoh360/thetaclient/ThetaRepository.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) {