first Karate is the best tool for API automation. Period. :D
I have setup a file called headers.js. As one of the headers contains the "locale variable" like -> var headers = { 'X-Country-Code': "US" ...} I need that as a global variable to be able to set other variables based on its value, but as it is specifically into the headers function, how I access its value within a karate.feature file?
JS headers.js
function fn() {
var env = 'us';
if (!env) {
env = 'us';
}
var headers = { 'X-Country-Code': "us", 'Content-Type': 'application/x-www-form-urlencoded' };
if (!env) {
env = 'ca';
}
var headers = { 'X-Country-Code': "ca", 'Content-Type': 'application/x-www-form-urlencoded' };
return headers;
}