Hello,
I would like to know if it is possible to set the authorization header from the puzzles when using send data. As per now, I’m saving the puzzle and hardcoding in the visual_logic.js after that.
// sendData puzzle
function sendData(data, url, callback) {
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
if (req.getResponseHeader(‘Content-Type’).indexOf(‘application/json’) > -1)
_pGlob.loadedFile = JSON.parse(req.responseText);
else
_pGlob.loadedFile = req.responseText;
callback();
}
};
req.open(‘POST’, url, true);
if (typeof data == ‘string’) {
req.setRequestHeader(‘Content-type’, ‘text/plain’);
} else {
// serialize to json
req.setRequestHeader(‘Content-type’, ‘application/json’);
data = JSON.stringify(data);
}
req.setRequestHeader(‘Authorization’, ‘xxxxxxx’);
req.send(data);
}
Attachments:
You must be
logged in to view attached files.