I have an API Proxy, where none of the target endpoints gets selected because of the conditions applied. Eventually I get an Error as expected. I have setup Javascript policy to be executed in the Error flow, where I setup a few headers in the response object as shown below:
var startTime = context.getVariable('client.received.start.timestamp');
var endTime = context.getVariable('system.timestamp');
var requestDuration = (endTime - startTime).toString();
context.setVariable('response.header.X-WF.Request-Duration', requestDuration);
When I enable the trace, I am able to see that the Javascript policy does get executed. But I don’t see the above header in the response that is sent back to the client.