Response Templating - String Encodings
WireMock Cloud provides several helpers for encoding and decoding values to/from various formats.
Base64
The base64
helper encodes and decodes Base64:
URLs
The urlEncode
helper encode and decode values according to the HTTP URL encoding standard:
Forms
The formData
helper parses its input as an HTTP form, returning an object containing the individual fields as attributes. The helper takes the input string and variable name as its required parameters, with an optional urlDecode
parameter indicating that values should be URL decoded.
The folowing example will parse the request body as a form, then output a single field formField3
:
If the form submitted has multiple values for a given field, these can be accessed by index: