Plugin that defines a pre-run hook that can record and mock http/s requests and responses during command execution based on an environment variable. Recorded requests are written to files based on the command name and topic. Commands can then use the recorded fixtures rather than making actual network calls. All
setTimeout calls can also be mocked so as to return on next tick, which is useful when using mocked responses.
This plugin does nothing until enabled with the
INTERCEPTOR_MODE environment variable.
|INTERCEPTOR_DISABLE_TIMEOUTS||By default the
|INTERCEPTOR_DISABLE_NET_CONNECT||By default all unexpected HTTP/S requests when in
|INTERCEPTOR_SCOPE_OVERRIDE||It can be useful to override the scope (protocol + domain + port) of the recorded requests to match a known scope. E.g., "https://my.test.domain:443"|
|INTERCEPTOR_MAX_POST_BODY||Multipart POST request bodies can be very large and cause problems with request matching. By default all POST request bodies are not written to the fixture for matching. This behavior can be modified by setting a body character length threshold where the request body will only be written when the length is less than the threshold. E.g.,
|INTERCEPTOR_OUTPUT_DIR||By default the current working directory is used as the base path for writing and using fixtures. To set this to another location use this env var.|
|INTERCEPTOR_FIXTURE_NAME||By default the interceptor uses the name of the command for the directory where fixtures are written to and read from. Use this variable to set the name to something else.|
|INTERCEPTOR_HOME_DIR||It can be useful to override the home directory of the OS to another location for mocking purposes. Set this variable to some path to achieve this behavior.|