var request = require('request');
async function doCall(pData){
var token;
var j = request.jar();
var postDataToSAP = function(){
return new Promise(function(resolve, reject){
request({
url : url,
jar : j,
headers: {
"Authorization": "Basic USERANDPWINBASE64",
"x-csrf-token" : "Fetch"
}
}, function(error, response, body){
token = response.headers["x-csrf-token"];
console.log("Obtenido el token csrf");
request({
url:url,
method: 'POST',
jar: j,
headers:{
"Authorization":"Basic USERANDPWINBASE64",
"Content-Type":"application/json",
"X-CSRF-Token":token, // set CSRF Token for post or update
},
json: pData
}, function(error, response, body){
console.log("Datos de indicadores transferidos a SAP de forma exitosa");
resolve();
});
});
});
}
await postDataToSAP();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |