During a call Im adding a header- "Required-ID" in postman.
I want to raise a fault if the header name is wrong , for example - if the header name is like requiredid,Requiredid etc... I want the header name to be Required-ID only.
How can I raise the fault?
Solved! Go to Solution.
Hi @Gopal D J,
HTTP headers are case insensitive, so the condition in this case to trigger you Raise Fault should be
<Condition> request.header.Required-ID != null </Condition>
Nevertheless if you still need to be case sensitive then one approach will be some javascript code to verify the presence of the header, like:
var found = false; for (var name in context.getVariable('request.headers.names').toArray()) { if ( name === 'Required-ID' ) { found = true; break; } } context.setVariable('_required_id', found);
Then in your flow add a condition to your RF policy as:
<Step> <Name>RF-Missing-Required-ID</Name> <Condition> _required_id == false </Condition> </Step>
Hope it helps.
Hi @Gopal D J,
HTTP headers are case insensitive, so the condition in this case to trigger you Raise Fault should be
<Condition> request.header.Required-ID != null </Condition>
Nevertheless if you still need to be case sensitive then one approach will be some javascript code to verify the presence of the header, like:
var found = false; for (var name in context.getVariable('request.headers.names').toArray()) { if ( name === 'Required-ID' ) { found = true; break; } } context.setVariable('_required_id', found);
Then in your flow add a condition to your RF policy as:
<Step> <Name>RF-Missing-Required-ID</Name> <Condition> _required_id == false </Condition> </Step>
Hope it helps.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |