Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_createXHRObject(): XMLHttpRequest {
if (typeof window === "undefined" && !this._isWebWorker()) {
// $FlowIssue - flow is not able to recognize this module.
return new (require("xhr2").XMLHttpRequest)();
}
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
}
throw new Error("XMLHttpRequest is not supported");
}
}
function POST(path,body,async,cb){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (cb){
cb(undefined,xhr.responseText);
}
} else if (error){
cb(xhr);
}
// Todo: else...?
}
};
xhr.open("POST", path, async); // Async
xhr.setRequestHeader("Accept", "text/xml, application/xml, application/soap+xml");
xhr.setRequestHeader("Content-Type", "text/xml");
xhr.send(body);
function POST(path,body,async,cb){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (cb){
cb(undefined,xhr.responseText);
}
} else if (error){
cb(xhr);
}
// Todo: else...?
}
};
xhr.open("POST", path, async); // Async
xhr.setRequestHeader("Accept", "text/xml, application/xml, application/soap+xml");
xhr.setRequestHeader("Content-Type", "text/xml");
xhr.send(body);
value: function _createXHRObject() {
if (typeof window === "undefined" && !this._isWebWorker()) {
// $FlowIssue - flow is not able to recognize this module.
return new (require("xhr2").XMLHttpRequest)();
}
if (typeof XMLHttpRequest !== "undefined") {
return new XMLHttpRequest();
}
throw new Error("XMLHttpRequest is not supported");
}
}], [{
build(): XMLHttpRequest { return new xhr2.XMLHttpRequest(); }
}
build() { return new xhr2.XMLHttpRequest(); }
}
build() { return new xhr2.XMLHttpRequest(); }
}