@@ -21,6 +21,7 @@ import java.io.BufferedReader
21
21
import java.io.File
22
22
import java.io.RandomAccessFile
23
23
import java.io.IOException
24
+ import java.lang.IllegalArgumentException
24
25
import java.security.SecureRandom
25
26
import java.security.cert.X509Certificate
26
27
import javax.net.ssl.HostnameVerifier
@@ -57,11 +58,11 @@ class Client @JvmOverloads constructor(
57
58
init {
58
59
headers = mutableMapOf (
59
60
" content-type" to " application/json" ,
60
- " user-agent" to " AppwriteKotlinSDK/7 .0.0 ${System .getProperty(" http.agent" )} " ,
61
+ " user-agent" to " AppwriteKotlinSDK/8 .0.0 ${System .getProperty(" http.agent" )} " ,
61
62
" x-sdk-name" to " Kotlin" ,
62
63
" x-sdk-platform" to " server" ,
63
64
" x-sdk-language" to " kotlin" ,
64
- " x-sdk-version" to " 7 .0.0" ,
65
+ " x-sdk-version" to " 8 .0.0" ,
65
66
" x-appwrite-response-format" to " 1.6.0" ,
66
67
)
67
68
@@ -217,7 +218,12 @@ class Client @JvmOverloads constructor(
217
218
*
218
219
* @return this
219
220
*/
221
+ @Throws(IllegalArgumentException ::class )
220
222
fun setEndpoint (endPoint : String ): Client {
223
+ require(endPoint.startsWith(" http://" ) || endPoint.startsWith(" https://" )) {
224
+ " Invalid endpoint URL: $endPoint "
225
+ }
226
+
221
227
this .endPoint = endPoint
222
228
return this
223
229
}
@@ -551,7 +557,7 @@ class Client @JvmOverloads constructor(
551
557
body
552
558
)
553
559
} else {
554
- AppwriteException (body, response.code)
560
+ AppwriteException (body, response.code, " " , body )
555
561
}
556
562
it.cancel(error)
557
563
return
@@ -602,7 +608,7 @@ class Client @JvmOverloads constructor(
602
608
body
603
609
)
604
610
} else {
605
- AppwriteException (body, response.code)
611
+ AppwriteException (body, response.code, " " , body )
606
612
}
607
613
it.cancel(error)
608
614
return
0 commit comments