Skip to content

Commit a698768

Browse files
committed
added request id generation
1 parent 614b2bc commit a698768

File tree

3 files changed

+71
-59
lines changed

3 files changed

+71
-59
lines changed

experimental.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
const request = require("request");
1313
const rest = require("./rest.js");
14-
14+
const crypto = require ('crypto');
1515

1616

1717
var domainName, username,password,timeout;
@@ -36,6 +36,15 @@ var loginStageCounter = 0;
3636
const maxRunningWorkflows = 20;
3737

3838

39+
function generateUUID()
40+
{
41+
//UI-93290e40-3e26-42a9-8bc3-b50c32b7115b
42+
var hexstring = crypto.randomBytes(16).toString("hex");
43+
var guidstring = "UI-" + hexstring.substring(0,8) + "-" + hexstring.substring(8,12) + "-" + hexstring.substring(12,16) + "-" + hexstring.substring(16,20) + "-" + hexstring.substring(20);
44+
//var uuid = "UI-" + crypto;
45+
return guidstring;
46+
}
47+
3948
function debug(message){
4049
dbg.message("<EXPERIMENTAL> " + message,4);
4150
}
@@ -206,7 +215,9 @@ function setHeaders()
206215
var headers = [
207216
{name:"authtoken",value:authtoken},
208217
{name:"accept",value:"application/json"},
209-
{name:"x-csrf-token",value:csrf},
218+
//{name:"x-csrf-token",value:csrf},
219+
{name:"X-Requested-With",value:"XMLHttpRequest"},
220+
{name:"X-Request-ID",value:generateUUID()},
210221
];
211222
return headers;
212223
}
@@ -333,7 +344,7 @@ function processRunningResponse(url,err,body,res){
333344
}
334345
else
335346
{
336-
dbg.message("Failed to get Running Workflows",1);
347+
dbg.message("DAVE Failed to get Running Workflows",1);
337348
dbg.message(err,1);
338349
process.exit(99);
339350
}
@@ -393,8 +404,8 @@ function processRunningResponse(url,err,body,res){
393404
else
394405
{
395406
dbg.message("Failed to get Running Workflows",1)
396-
dbg.message(err,4)
397-
dbg.message(body,4)
407+
if(body!=null)dbg.message(JSON.stringify(body),1);
408+
if(err!=null)dbg.message(JSON.stringify(err),2);
398409
process.exit(99);
399410
}
400411
}

package-lock.json

Lines changed: 54 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wmiocli.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var flowservice = require('./flowservice.js');
1818
var experimental = require('./experimental.js');
1919
const { setLogLevel } = require('./debug.js');
2020

21+
2122
dbg = require('./debug.js');
2223
prettyprint = false;
2324
proxy = undefined;

0 commit comments

Comments
 (0)