Unable to pass value into the body of post request

I’m new to K6 and trying to create my first script.
I’ve used K6 browser recorder and converted recoded HAR into script.
In the script, inside “Group 1” I capture a string that I need to use in “Group 3” but all attempts to pass the string into post request body have failed.
Here is “Group 3”. When I replay script with option httpDebug: 'full' console output shows that tmp has correct value but in post request it shows as SomeID=%24%7Btmp%7D and request fails.
What am I doing wrong?

group('Group 3 - https://something.com/blah/home',
function () {
  const tmp = capturedValue;
  console.log("==================================tmp = ",tmp);
  response = http.post(
    'https://something.com/blah/home',
    {
      FOO: '1',
      BAR: '0',
      Yada: 'Page',
      Blah: '0',
      Number: '1',
      String: 'CAT',
      SomeID: '${tmp}',
      SomeData: '',
    },
    {
      headers: {
        'content-type': 'application/x-www-form-urlencoded',
        referer:
          'https://something.com/blah/origin',
        'user-agent':
          'Mozilla/5.0 etc',
      },
    })

Hi @sonia2024 , welcome to the community forum!

%24%7Btmp%7D is the urlencoded form of the ‘${tmp}’ string, I think, you just have to use simply

SomeID: tmp,

I hope this helps

1 Like