Hi guys,
is the ordering of Elements in an AssignMessage relevant for its execution?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage name="AM-Token" enabled="true" continueOnError="false"> <Remove> <Headers> <Header name="Authorization"/> </Headers> </Remove> <Add> <Headers> <Header name="Authorization">Bearer {private.cached.my_access_token}</Header> </Headers> </Add> <AssignTo createNew="true" transport="http" type="request"/> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </AssignMessage>
vs.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage name="AM-Token" enabled="true" continueOnError="false"> <Add> <Headers> <Header name="Authorization">Bearer {private.cached.my_access_token}</Header> </Headers> </Add> <Remove> <Headers> <Header name="Authorization"/> </Headers> </Remove <AssignTo createNew="true" transport="http" type="request"/> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </AssignMessage>
Brings a different result for me ... is that expected behaviour? Because I don't find something about ordering within the documentation.
Answer by Priyadarshi Ajitav Jena · Feb 23 at 06:32 PM
Yes, the order is important in this case. It executes top to bottom. So, if you remove the variable first then it will become null and next assignment will be to null.
We should update the documentation to state something about ordering.
Yes, this scenario should be documented. It's almost 6th or 7th time I have seen developers having confusion.
How do I transform the path between the proxy and the target? 9 Answers
Read assignMessage from sharedflow 0 Answers
How do you pass arrays in a QueryParam in an AssignMessage policy? 2 Answers
Assign Message OR condition check 1 Answer
CORS Error : header contains multiple values '*, *', but only one is allowed 2 Answers