I have developed a “pre-request” script that includes generating variables that I need to use in that request. (I’m using async function)
The variables are being generated correctly as I’m printing them in the console. However, it seems that the request is not getting the values so the response is 403 Forbidden. If I set fixed values in the body request, the request comes through successfully. API key is sent in the header.
Part of the body request
Response:
@danny-dainton
If you look the console log for the request. What is it showing for the request body?
Are the variables being transposed correctly. You should be able to confirm this from the console log.
Can you share your script which generates the variables. How are the variables being set? What type of variable is being used? Collection, Environment, local??
Hi @michaelderekjones thanks for the response. The variables values were not shown on the console. But I was able to fix the problem. I was using “async” in my script and that’s why the variables were not updated. Now, my “pre-request” script is working as expected and I’m able to use the environment variables inside the request body.
1 Like