My Fellow Postmanauts,
I must be fried. I only have 3 days left to complete the last 5 challenges so this one is slipping away from me.
I cannot for the life of me get the {{payload}] env variable to update to match the hexPayload set in the pre-script. Here is my pre-script code.
let color_var = pm.variables.replaceIn('{{$randomHexColor}}');
let hex_var = color_var.slice(1);
let hexPayload = pm.sendRequest("http://www.thecolorapi.com/id?hex=" + hex_var, function (err, response) {
let JSONResponse = response.json();
let bodyBuild = {
hex: JSONResponse.hex.value,
rgb:JSONResponse.rgb.value,
name:JSONResponse.name.value
}
return JSON.stringify(bodyBuild);});
pm.environment.set("payload",hexPayload);```