Merge pull request #9974 from KaiVolland/9865-xhr
Introduces the _withCredentials flag
This commit is contained in:
@@ -4,6 +4,13 @@
|
||||
import {VOID} from './functions.js';
|
||||
import FormatType from './format/FormatType.js';
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {boolean} withCredentials Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
|
||||
* @private
|
||||
*/
|
||||
let withCredentials = false;
|
||||
|
||||
/**
|
||||
* {@link module:ol/source/Vector} sources use a function of this type to
|
||||
* load features.
|
||||
@@ -62,6 +69,7 @@ export function loadFeaturesXhr(url, format, success, failure) {
|
||||
if (format.getType() == FormatType.ARRAY_BUFFER) {
|
||||
xhr.responseType = 'arraybuffer';
|
||||
}
|
||||
xhr.withCredentials = withCredentials;
|
||||
/**
|
||||
* @param {Event} event Event.
|
||||
* @private
|
||||
@@ -131,3 +139,14 @@ export function xhr(url, format) {
|
||||
}
|
||||
}, /* FIXME handle error */ VOID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the withCredentials configuration for the XHR.
|
||||
*
|
||||
* @param {boolean} xhrWithCredentials The value of withCredentials to set.
|
||||
* Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
|
||||
* @api
|
||||
*/
|
||||
export function setWithCredentials(xhrWithCredentials) {
|
||||
withCredentials = xhrWithCredentials;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user