aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-remote/src/main/kotlin
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-01-19 22:46:42 +0100
committerRobert Jaros <rjaros@finn.pl>2020-01-19 22:46:42 +0100
commit234c921842fbf5a3b20acb443ddc711a3ca2937e (patch)
tree57a3ddba7b6b66ee3f8ff23297df4dff49f394ce /kvision-modules/kvision-remote/src/main/kotlin
parent110c60e71d1f66a521764e3768b140744d28bee7 (diff)
downloadkvision-234c921842fbf5a3b20acb443ddc711a3ca2937e.tar.gz
kvision-234c921842fbf5a3b20acb443ddc711a3ca2937e.tar.bz2
kvision-234c921842fbf5a3b20acb443ddc711a3ca2937e.zip
Add support for authenticated CORS requests
Diffstat (limited to 'kvision-modules/kvision-remote/src/main/kotlin')
-rw-r--r--kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
index 58ba7368..eca6dbb0 100644
--- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
+++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/CallAgent.kt
@@ -29,7 +29,6 @@ import pl.treksoft.jquery.JQueryXHR
import pl.treksoft.jquery.jQuery
import kotlin.browser.window
import kotlin.js.Promise
-import kotlin.js.undefined
import kotlin.js.JSON as NativeJSON
/**
@@ -101,6 +100,9 @@ open class CallAgent {
reject(Exception(message))
}
}
+ this.xhrFields = obj {
+ this.withCredentials = true
+ }
})
}
}
@@ -111,7 +113,7 @@ open class CallAgent {
* @param data data to be sent
* @param method a HTTP method
* @param contentType a content type of the request
- * @param beforeSend a content type of the request
+ * @param beforeSend a function to set request parameters
* @return a promise of the result
*/
@Suppress("UnsafeCastFromDynamic", "ComplexMethod")
@@ -148,6 +150,9 @@ open class CallAgent {
}
}
this.beforeSend = beforeSend
+ this.xhrFields = obj {
+ this.withCredentials = true
+ }
})
}
}