aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-05-10 00:35:35 +0200
committerRobert Jaros <rjaros@finn.pl>2020-05-10 00:35:35 +0200
commit04eed3d0b23a1c1e7887ec0168cb3b02807a2a58 (patch)
tree699544cc178e1eaa9474724162da95ac9d1dc76a /src/main
parent69a8b03ba9668be257e2db375d6ee58e51e367b7 (diff)
downloadkvision-04eed3d0b23a1c1e7887ec0168cb3b02807a2a58.tar.gz
kvision-04eed3d0b23a1c1e7887ec0168cb3b02807a2a58.tar.bz2
kvision-04eed3d0b23a1c1e7887ec0168cb3b02807a2a58.zip
Fix RestClient data serialization.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/rest/RestClient.kt16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/rest/RestClient.kt b/src/main/kotlin/pl/treksoft/kvision/rest/RestClient.kt
index 9011c780..f7091f96 100644
--- a/src/main/kotlin/pl/treksoft/kvision/rest/RestClient.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/rest/RestClient.kt
@@ -31,7 +31,7 @@ import pl.treksoft.jquery.JQueryAjaxSettings
import pl.treksoft.jquery.JQueryXHR
import pl.treksoft.jquery.jQuery
import pl.treksoft.kvision.types.DateSerializer
-import pl.treksoft.kvision.utils.JSON.toObj
+import pl.treksoft.kvision.utils.JSON
import pl.treksoft.kvision.utils.obj
import kotlin.js.Date
import kotlin.js.Promise
@@ -131,7 +131,7 @@ open class RestClient {
contentType: String = "application/json",
beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null
): Promise<dynamic> {
- return remoteCall(url, data.toObj(serializer), method, contentType, beforeSend)
+ return remoteCall(url, JSON.plain.stringify(serializer, data), method, contentType, beforeSend)
}
@@ -157,7 +157,13 @@ open class RestClient {
beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null,
transform: ((dynamic) -> dynamic)? = null
): Promise<T> {
- return remoteCall(url, data.toObj(serializer), method, contentType, beforeSend).then { result: dynamic ->
+ return remoteCall(
+ url,
+ JSON.plain.stringify(serializer, data),
+ method,
+ contentType,
+ beforeSend
+ ).then { result: dynamic ->
val transformed = if (transform != null) {
transform(result)
} else {
@@ -413,7 +419,7 @@ open class RestClient {
contentType: String = "application/json",
beforeSend: ((JQueryXHR, JQueryAjaxSettings) -> Boolean)? = null
): Promise<Response<dynamic>> {
- return remoteRequest(url, data.toObj(serializer), method, contentType, beforeSend)
+ return remoteRequest(url, JSON.plain.stringify(serializer, data), method, contentType, beforeSend)
}
@@ -441,7 +447,7 @@ open class RestClient {
): Promise<Response<T>> {
return remoteRequest(
url,
- data.toObj(serializer),
+ JSON.plain.stringify(serializer, data),
method,
contentType,
beforeSend