Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DaRiv94/2ce245fe9c4e05d0d14b19517c81f61c to your computer and use it in GitHub Desktop.
Save DaRiv94/2ce245fe9c4e05d0d14b19517c81f61c to your computer and use it in GitHub Desktop.
Azure API Management Conditional Transformation Policy Example
<choose>
<when condition="@(context.Response.StatusCode == 200 && context.Product?.Name != "Unlimited")">
<set-body>@{
var response = context.Response.Body.As<JObject>();
foreach (var key in new [] {"hair_color", "skin_color", "eye_color", "gender"}) {
response.Property(key).Remove();
}
return response.ToString();
}
</set-body>
</when>
</choose>
@Awesomefelix
Copy link

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment