Policies

Replace String in Response Body Policy

Replace a string in the incoming request body

Configuration

The configuration shows how to configure the policy in the 'policies.json' document.

{ "name": "my-replace-string-outbound-policy", "policyType": "replace-string-outbound", "handler": { "export": "ReplaceStringOutboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "match": "/(\\d+)/g", "mode": "regexp", "replaceWith": "1234" } } }

Policy Options

The options for this policy are specified below. All properties are optional unless specifically marked as required.

  • mode <string> (Required) -
    The type of string replacement to perform.
    Allowed values are regexp, and string.
  • match <string> (Required) -
    The pattern to match.
  • replaceWith <string> (Required) -
    The value to each match is replaced with.

Using the Policy

Read more about how policies work

Previous
XML to JSON Outbound