How can I use variables in "postRequest" headers and body?

**In the tests there is a need to use “postRequest” but there are required headers for that request. For the current headers are set variables **

This is the example, but does not work:

const postRequest = {
url: ${pm.variables.get('url')}://${pm.variables.get('host')}/${pm.variables.get('path_prefix')}/v2/example/add,
method: ‘POST’,
header: {
‘Content-Type’: ‘application/json’,
’User’: ‘{{user}}’,
’id’: '{{id}}'
},
body: {
newId: ‘{{newID}}’,
raw: JSON.stringify({ key: ‘this is json’ })
}
};
pm.sendRequest(postRequest, (error, response) => {
console.log(error ? error : response.json());
});

My question:

  1. How can use the already set variables as a Header value in the “postRequest” ?
  2. How can use the already set variables as a Body key’s value in the “postRequest” ?

Details (like screenshots):

How I found the problem:

I’ve already tried:

you can use:

pm.variables.replaceIn("this will replace {{user}} with user variable value")