troubleshooting

render a response or forward template against a sample request without creating an expectation

Dry run of a Velocity, Mustache or JavaScript template. Renders the template against the sample request with the same engines, sandbox settings and JavaScript and Velocity timeouts as serving, and reports the rendered response (or request, for a forward template), or the failure with the template line and column where the engine reports one and a hint for common mistakes. A Velocity reference or Mustache variable that did not resolve, and a scenario.set call, are reported as warnings; a dry run never changes scenario state and writes nothing to the event log. When javascriptTemplateExecutionTimeout or velocityTemplateExecutionTimeout is 0 a dry run still stops that template after 5 seconds. At most two dry runs run at once and further calls get a 429; a Mustache template, or a Velocity template inside one long Java call, cannot be stopped, so the response is written after the time limit plus a grace period even if the template is still running. Running a template needs a role that may change expectations.

put/mockserver/template/test

Request

  • Base URL: http://localhost:1080
  • URL: http://localhost:1080/mockserver/template/test
  • Auth: none declared

Request body

templateType'VELOCITY' | 'MUSTACHE' | 'JAVASCRIPT' required
templatestring required

the template, as it would appear in an httpResponseTemplate or httpForwardTemplate

actionType'RESPONSE_TEMPLATE' | 'FORWARD_TEMPLATE'

whether the template renders a response or the request to forward

Response

the template was evaluated; valid says whether it rendered a usable response or request

templateTypestring
actionTypestring
validboolean

true when the template rendered a valid response (or request); serving an invalid template answers 500, or with templateFailureAsServerError=false an invalid response template answers 404 and an invalid forward template 502

durationMillisinteger
renderedResponseobject

the rendered response, for a valid RESPONSE_TEMPLATE

renderedRequestobject

the rendered request, for a valid FORWARD_TEMPLATE

renderedOutputstring

the raw rendered text, when it is not a valid response or request or is too large to return as an object

renderedOutputTruncatedboolean

true when renderedOutput was cut to its first 65536 characters

timedOutboolean

Changes

No recorded changes to this operation across all 1 revision of this API.