I’m trying to retrieve a header valye ‘idempotency_key’. The problem is that when ‘idempotency_key’ isn’t passed. i get its value as undefined, but can’t really check it in an ‘if’ condition.
var idempotency_key = request.headers['idempotency_key'];
print("idempotency_key1:" +JSON.stringify(idempotency_key)); // prints undefined
print("type:" +typeof idempotency_key); // prints'object'
print("1:" +idempotency_key == ""); // false
print("2:" +idempotency_key === undefined); // false
print("messageid:" +context.getVariable("messageid"));
if(!idempotency_key || idempotency_key == undefined){
// do A // never enters this code
}else{
// do B
}