2.0.24 • Published 3 months ago

@oclif/plugin-interceptor v2.0.24

Weekly downloads
1
License
MIT
Repository
github
Last release
3 months ago

plugin-interceptor

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.

oclif Version Downloads/week License

Usage

This plugin does nothing until enabled with the INTERCEPTOR_MODE environment variable.

Environment Variables

Env VarDescription
INTERCEPTOR_MODESet to record to record HTTP/S requests made by commands. Set to mock to use the recorded fixtures.
INTERCEPTOR_QUIETSet to true to suppress console output.
INTERCEPTOR_DISABLE_TIMEOUTSBy default the setTimeout function is overridden to execute the callback on next tick, which is useful when using recorded fixtures. Set to false to prevent this behavior.
INTERCEPTOR_DISABLE_NET_CONNECTBy default all unexpected HTTP/S requests when in mock mode are blocked and will cause an error. Set to false to allow these requests to be made.
INTERCEPTOR_SCOPE_OVERRIDEIt 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_BODYMultipart 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_MAX_POST_BODY=5000
INTERCEPTOR_OUTPUT_DIRBy 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_NAMEBy 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_DIRIt 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.
2.0.24

3 months ago

2.0.23

4 months ago

2.0.15

10 months ago

2.0.16

10 months ago

2.0.14

11 months ago

2.0.19

7 months ago

2.0.17

9 months ago

2.0.18

9 months ago

2.0.22

5 months ago

2.0.20

7 months ago

2.0.21

6 months ago

2.0.13

11 months ago

2.0.12

12 months ago

2.0.11

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.5

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.3

2 years ago

2.0.4

1 year ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

3 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago