Skip to content

Commit e792a8d

Browse files
support for sending cookies in request
1 parent ee77d14 commit e792a8d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var setup = { // Object that contain settings. Properties in brackets can be mis
4545
[ , namespace: "SAMPLES" ] // current namespace : default namespace
4646
[ , username: "USER" ] // user name : default user
4747
[ , password: "" ] // user password : default password
48+
[ , sendCookies: false ] // also send cookies with each request to server
4849
}
4950
[ , triggers: { // provide your functions here to handle certain events
5051
drillDown: function ({Object { level: {number}, mdx: {string} }}) {}

source/js/DataSource.js

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var DataSource = function (config, globalConfig, lpt) {
1717
this.PASSWORD = config["password"];
1818
this.LPT = lpt;
1919
this.GLOBAL_CONFIG = globalConfig;
20+
this.SEND_COOKIES = config["sendCookies"] || false;
2021

2122
this.BASIC_MDX = config.basicMDX;
2223

@@ -40,6 +41,7 @@ var DataSource = function (config, globalConfig, lpt) {
4041
DataSource.prototype._post = function (url, data, callback) {
4142
var xhr = new XMLHttpRequest();
4243
xhr.open("POST", url);
44+
if (this.SEND_COOKIES) xhr.withCredentials = true;
4345
xhr.onreadystatechange = function () {
4446
if (xhr.readyState === 4 && xhr.status === 200) {
4547
callback((function () {

0 commit comments

Comments
 (0)