Skip to content

Commit 3961b28

Browse files
committed
Fix Kotlin
1 parent b0ba1bf commit 3961b28

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

templates/kotlin/src/main/kotlin/io/appwrite/Client.kt.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class Client @JvmOverloads constructor(
449449

450450
@Suppress("UNCHECKED_CAST")
451451
override fun onResponse(call: Call, response: Response) {
452-
if (!response.isSuccessful) {
452+
if (response.code < 300 || response.code >= 400) {
453453
val body = response.body!!
454454
.charStream()
455455
.buffered()

tests/languages/kotlin/Tests.kt

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,14 @@ class ServiceTest {
124124

125125
general.empty()
126126

127-
try {
128-
val url = general.oauth2(
129-
clientId = "clientId",
130-
scopes = listOf("test"),
131-
state = "123456",
132-
success = "https://localhost",
133-
failure = "https://localhost",
134-
)
135-
writeToFile(url)
136-
} catch(e: Exception) {
137-
writeToFile("Was exception")
138-
writeToFile(e.message)
139-
}
127+
val url = general.oauth2(
128+
clientId = "clientId",
129+
scopes = listOf("test"),
130+
state = "123456",
131+
success = "https://localhost",
132+
failure = "https://localhost",
133+
)
134+
writeToFile(url)
140135

141136
// Query helper tests
142137
writeToFile(Query.equal("released", listOf(true)))

0 commit comments

Comments
 (0)