@@ -5,7 +5,7 @@ const args = process.argv.slice(2);
5
5
// Secret key for HMAC
6
6
const SECRET_KEY = 'test_secret_key' ;
7
7
// const SERVER_URL = 'http://192.168.1.99:8675';
8
- const SERVER_URL = 'http://localhost :8675' ;
8
+ const SERVER_URL = 'http://0.0.0.0 :8675' ;
9
9
10
10
const calculateHMAC = ( route , timestamp , body ) => {
11
11
const stringifiedBody = body ? JSON . stringify ( body ) : "" ;
@@ -498,6 +498,30 @@ async function makeDenesterRequest() {
498
498
}
499
499
}
500
500
501
+ async function willRequest ( ) {
502
+ // Construct the URL for the POST request
503
+ const route = '/command/submit' ;
504
+ const url = `${ SERVER_URL } ${ route } ` ;
505
+
506
+ const body = {
507
+ commands : [ 'my/command/script.rs' ]
508
+ } ;
509
+
510
+ try {
511
+ console . time ( "My Call" )
512
+ const response = await axios . post ( url , body ) ;
513
+ console . timeEnd ( "My Call" )
514
+ console . log ( 'Status:' , response . status ) ;
515
+ console . log ( 'Data:' , response . data ) ;
516
+ } catch ( error ) {
517
+ console . timeEnd ( "My Call" )
518
+ console . error ( 'Error Message:' , error . message ) ;
519
+ console . error ( 'status:' , error . response . status ) ;
520
+ console . error ( 'statusText:' , error . response . statusText ) ;
521
+ console . error ( 'data:' , error . response . data ) ;
522
+ }
523
+ }
524
+
501
525
const entreeId = args [ 1 ] || "<entreeId>"
502
526
const entree = {
503
527
externalOrderId : "12345" ,
@@ -565,6 +589,9 @@ switch (args[0]) {
565
589
case 'denester' :
566
590
makeDenesterRequest ( ) ;
567
591
break ;
592
+ case 'will' :
593
+ willRequest ( ) ;
594
+ break ;
568
595
default :
569
596
console . log ( 'Unknown endpoint command' ) ;
570
597
}
0 commit comments