Our methods support handlebars like templating ({{}}
)along with the following special methods to make your responses dynamic
-
urlParams
You can define parameters inside the mock endpoint using a colon (
:
).For example - the endpoint
/book/:id
defines theid
parameter that can be used inside the body of your mocks as{{urlParams id}}
-
header
The value of any of the request headers can be dynamically rendered into your response using this method.
For example - the string
{{header content-type}}
renders the value of the content-type header -
method
: You can add the request method to your mock's response body by including{{method}}
in your mock response -
statusCode
: Renders the original status code inside the template
Let us know if you have ideas for other templating methods that you might need.