Create a new header based on the result of Javascript method

I want to add a new header 'new-header' to the request if one of my javascript methods returns true. I'm new on this, can anyone help me?

Solved Solved
0 1 80
1 ACCEPTED SOLUTION

Hello, in your javascript file you can do this
context.setVariable('request.header.<YourHeaderKey>','<YourHeaderValue>');

example for a header called "new-header", applied to the Request object:

if (myFunction()) { // truthy
  context.setVariable('request.header.new-header','any-value-here');
}

View solution in original post

1 REPLY 1

Hello, in your javascript file you can do this
context.setVariable('request.header.<YourHeaderKey>','<YourHeaderValue>');

example for a header called "new-header", applied to the Request object:

if (myFunction()) { // truthy
  context.setVariable('request.header.new-header','any-value-here');
}