@Thomas Moeller Thanks for reaching out and I have reached out to my team if this is the expected behavior/limitation. It looks like yours body.page_index
has the value of string type and not integer.
When the value is of type string then it appends the two values but in case if it is integer value then it adds the two values.
Policy:
<set-body template="liquid">
<cust>{<!-- -->{ 5 | Plus: 1 }}</cust>
</set-body>
Output:
"output": "<cust>6</cust>"
Policy:
<set-body template="liquid">
<cust>{<!-- -->{ "5" | Plus: 1 }}</cust>
</set-body>
**Output: **
"output": "<cust>51</cust>"
**Update: **
I got the confirmation from my team unfortunately as of now, if you have string value and leverage the Plus within liquid, then APIM treats it as string and appends it and the above expression output is expected outcome as of now.
@Thomas Moeller Thanks for sharing the workaround.
You have created the policy in outbound section to declare the int variable using set-variable and leverage this variable in your outbound policy of the liquid template
<set-variable name="newindexasint" value="@(int.Parse(context.Response.Body.As<JObject>(preserveContent: true)["page_index"].ToString()))" />
"PageIndex": {{ context.Variables["newindexasint"]|Plus: 1 }}