Mocking from the CLI
Introduction
There are three ways to mock requests from the CLI
Dynamically configure the proxy to mock with the
intercept
commandThe
mock
commandThe
request response get
command
Intercept Command
The intercept
command is used to configure the proxy settings with the CLI. In our case, we can use it to configure stoobly-agent
to intercept and mock requests.
Here's the configure
sub-command to configure the proxy mode and policy.
Run that command and set the mode to mock
. Optionally add extra option flags as needed.
Next, enable the proxy to start mocking. This is equivalent to pressing the Run button in the UI
Finally send some requests to the Agent and see your mocked HTTP requests!
As cleanup, you can optionally disable the intercept mock mode with:
Mock Command
Here is the CLI command to mock HTTP requests:
Its usage is very similar to cURL
where you specify a URL and flags with extra request data.
For example here's a GET request:
For example here's a POST request
Response Get Command
If you already have the request's key handy, you can use the request response get
command
For example, if your Request key is "eyJwIjogMCwgImkiOiAzNjl9", the command would look like this:
Last updated