In a postman request json body, I want to set a variable to a variable.
This works fine for the built in $timestamp, But can I do it for other numerics?
It seems that postman always sends the variable as a string encoding.
For Example, in the pre-request script:
var lat = +pm.environment.get('lat');
lat = clat + 0.001;
console.log(lat);
pm.environment.set('lat', Number.parseFloat(lat).toPrecision(5));
In the body:
{
"unixTimeStamp": {{$timestamp}}, //OK
"lng": 145.123, // OK
"lat": {{$lat}}, // Fails
}
This sends:
{
"unixTimeStamp": 1521769729,
"lng": 145.123,
"lat": "-37", // Web service rejects this field.
}
I believe that numeric is always encoded as a string.