Postman how to get request body with already substituted variables

Hi,

could you help me with one thing

I need to save request body (json with variables) to use it later in my prerequest script. Unfortunately when I display request data

console.log(request.data);

It looks for example like this:

{

“session”: “{{session}}”,

“playerid”: “{{playerid}}”,

“currency”: “{{currencyCode}}”,

“action”:

{ “command”: “com”,

“parameters”: {

“country”: “{{countryCode}}”

} } }

Is there a possibility to get request body in Pre-req. with already substituted variables?

Where are you putting the console.log() statement?
If you are putting it in the Pre-Request tab then this is expected to be the output as the request has not been made yet and as a result not populated.

If you move this statement to the Tests tab, it will populate those values for you.

Hi, I need it in pre request script, console.log just checking if I can get this data to use it later in prerequest.
I have a solution already, we can close the topic thank you :slight_smile: