Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const args = process.argv.slice(2);
// Secret key for HMAC
const SECRET_KEY = 'test_secret_key';
// const SERVER_URL = 'http://192.168.1.99:8675';
const SERVER_URL = 'http://localhost:8675';
const SERVER_URL = 'http://0.0.0.0:8675';

const calculateHMAC = (route, timestamp, body) => {
const stringifiedBody = body ? JSON.stringify(body) : "";
Expand Down Expand Up @@ -498,6 +498,30 @@ async function makeDenesterRequest() {
}
}

async function willRequest() {
// Construct the URL for the POST request
const route = '/command/submit';
const url = `${SERVER_URL}${route}`;

const body = {
commands: ['my/command/script.rs']
};

try {
console.time("My Call")
const response = await axios.post(url, body);
console.timeEnd("My Call")
console.log('Status:', response.status);
console.log('Data:', response.data);
} catch (error) {
console.timeEnd("My Call")
console.error('Error Message:', error.message);
console.error('status:', error.response.status);
console.error('statusText:', error.response.statusText);
console.error('data:', error.response.data);
}
}

const entreeId = args[1] || "<entreeId>"
const entree = {
externalOrderId: "12345",
Expand Down Expand Up @@ -565,6 +589,9 @@ switch (args[0]) {
case 'denester':
makeDenesterRequest();
break;
case 'will':
willRequest();
break;
default:
console.log('Unknown endpoint command');
}