Inputs
Only match requests that have this HTTP Method
Javascript code used to generate a response for the intercepted requests. This code must return a Javascript
Response
object. This
code behaves similarly to Momentic’s standard javascript step with a couple of
exceptions:- Environment variables can be read at
env.<VARIABLE_NAME>
, however, they cannot be updated usingsetVariable
. This is to prevent potential race conditions. - The request itself is accessible at
mock.request
. It is a standard Javascript request object. - If the ‘fetch real response’ config is enabled, the original response is accessible at
mock.response
. It is a standard Javascript response object.
Configs
Complete the original request, and pass its response into the generator as
mock.response
. Enabling this option is helpful if you want to modify the
original response rather than fully replacing it. You should not enable this
option if the request will fail (for example if the host is inaccessible), as
it will cause the mock to fail.A key that can be used to reference the mock later. This should be set if you
want to remove the mock later in the test. If not set, a random key will be
generated.
Store the output of this step into the environment at the given key. This
configuration only applies for steps that output data.