Skip to content

Commit 70c52d3

Browse files
committed
Adds an example for Will
1 parent b9d4ce2 commit 70c52d3

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

app.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const args = process.argv.slice(2);
55
// Secret key for HMAC
66
const SECRET_KEY = 'test_secret_key';
77
// 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';
99

1010
const calculateHMAC = (route, timestamp, body) => {
1111
const stringifiedBody = body ? JSON.stringify(body) : "";
@@ -498,6 +498,30 @@ async function makeDenesterRequest() {
498498
}
499499
}
500500

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+
501525
const entreeId = args[1] || "<entreeId>"
502526
const entree = {
503527
externalOrderId: "12345",
@@ -565,6 +589,9 @@ switch (args[0]) {
565589
case 'denester':
566590
makeDenesterRequest();
567591
break;
592+
case 'will':
593+
willRequest();
594+
break;
568595
default:
569596
console.log('Unknown endpoint command');
570597
}

0 commit comments

Comments
 (0)