I cant use user defined tags and headers together

When I pass the tags argument next to the URL or payload on an HTTP call. We can able to filter the results with tags but we missing the custom header value on the request due to which my request is failing

let params{
headers:{ header1:‘headervalue1’},};
const workorder1 = http.get(‘URL’,{tags : {name:‘workorder_1’}}, params );

Incase of using headers after URL we couldnt able to filter using tags but headers are woking in this case

let params{
headers:{ header1:‘headervalue1’},};
const workorder1 = http.get(‘URL’, params ,{tags : {name:‘workorder_1’},},);

Any idea anything i am missing??

Hi @bijayanandaP

Can you try this

const workorder1 = http.get('URL',
  {
    headers: {
      header1: 'headervalue1'
    },
    tags: {
      name: 'workorder_1'
    }
  });

@rdt.one here the use case is i have multiple request under one group and they have common header values but different tags. so we need to define header values in one place.

The above fix you have provided its working but for more number of apis we cant provide headers everytime but to declare the headers at one place and call it were ever required. so tried like this

let params{
headers:
{ header1:‘headervalue1’,
 header1:‘headervalue1’,
},
};

const workorder1 = http.get(‘URL’,`params`,
      {
        tags: { name: 'T01__WORKORDER'},
       },
);

const workorder2 = http.get(‘URL2’,`params`,
{
        tags: { name: 'T02__WORKORDER'},
       },
);

It should be fairly simple, you just need to place the headers and tags inside the same curly brackets, as shown below.

let params = {
  header1: 'headervalue1',
  header2: 'headervalue1'
};

const workorder1 = http.get('URL1',
  {
    headers: params,
    tags: { name: 'T01__WORKORDER' }
  }
);

const workorder2 = http.get('URL2',
  {
    headers: params,
    tags: { name: 'T02__WORKORDER' }
  }
);