The simulate.success: command is used inside an on_simulate: event handler to provide mock output and trigger the enclosing command's on_success: event during simulation.

start:
  http.request:
    output: http_response
    inputs:
      method: GET
      url: https://api.example/
    on_simulate:
      simulate.success:
        status_code: 200
        content_type: application/json
        body: '{"result":"ok"}'
    on_success:
      return:
        body@key: http_response:body

Syntax

output keys:

The optional key/value pairs provided to simulate.success: are merged into the output: placeholder of the enclosing command, exactly as if the command had run and succeeded. The expected keys depend on the command being simulated (e.g. status_code:, body: for http.request:).

on_simulate:

simulate.success: is itself only valid inside an on_simulate: event handler. It cannot be used outside of simulation context.

on_success:

After simulate.success: runs, the enclosing command's on_success: event is executed with the simulated output available in the output: placeholder.

on_error:

Not applicable. simulate.success: always triggers the on_success: path. Use simulate.error: to trigger the on_error: path instead.

See also