Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@bednarik_radek/mockserver-cli
Advanced tools
CLI utility for Mock-server client. Allows for easy creation/deletion of expectations on the Mock-server instance.
Utility for handling expectations setup, teardown and other action on MockServer instance.
run npm i -g mockserver-cli
. Global installation is recommended for usage of the library. So it will be accessible from any directory.
run npx expectations -h
to see the list of available commands. Will display something like this:
npx expectations -h
# output
Usage: expectations [options] [command]
Options:
-V, --version output the version number
-c, --config <path> set config path. defaults to './mockserver.config.json' (default: "./mockserver.config.json")
--concurrency <number> set number of concurrent requests. defaults to '10' (default: "10")
-h, --help display help for command
Commands:
set <paths...> send prepared expectations up to the mockserver instance
clear <paths...> clear all expectations from the mockserver instance
reset resets everything in the running mockserver instance
help [command] display help for command
clone the repository
run npm i
to install dependencies
npx expectations set -c ./examples/mockserver.config.json ./examples/expectations/expectation1.json
Example:
{
"host": "localhost",
"port": 5999,
"protocol": "<http|https>"
}
File can be placed anywhere. If -c
or --config
option is not provided, program will look for mockserver.config.json
in the current directory.
Concurrency of promises sets, how many promises many promises will be held in the queue at max to resolve. Defaults to 10
.
This limiting is applied for both set
and clear
commands.
set
is limited for how many expectations requests to mock-server can be sent at once.
clear
is limited for how many expectations.json
files can be processed at once. If the expectations array in the file contains multiple expectations, they will be processed one by one sequentially.
Uses p-queue library under the hood.
npx expectations --concurrency=5 set ./examples/expectations/expectation1.json
Expectations definitions are stored in json
files. These files can be placed anywhere.
file name must end with .expectations.json
file must contain array of expectations objects
see Mockserver documentation for more details about expectations
Example:
[
{
"httpRequest": {
"method": "GET",
"path": "/api/test/endpoint/v1"
},
"httpResponse": {
"statusCode": 200,
"body": "Hello World!"
}
},
{
"httpRequest": {
"method": "GET",
"path": "/api/test/endpoint/v2"
},
"httpResponse": {
"statusCode": 200,
"body": {
"message": "Hello World!",
"flag": "test"
}
}
}
]
npx expectations -c=some/filepath/mockserver.config.json --concurrency=50 set ./examples/expectations/expectation1.json
npx expectations set ./examples/expectations/expectation1.json ./examples/expectations/expectation2.json
npx expectations set ./examples/expectations
npx expectations set ./examples/expectations ./examples/expectations2
npx expectations clear ./examples/expectations/expectation1.json
npx expectations clear ./examples/expectations/expectation1.json ./examples/expectations/expectation2.json
npx expectations clear ./examples/expectations
npx expectations clear ./examples/expectations ./examples/expectations2
npx expectations reset
Logging is done via pino.js library. Currently, there is only the possibility to log to the console.
These are done via ENV
variables.
LOG_LEVEL
- set log level. Defaults to info
if not provided.
LOG_ENABLED
- set log enabled. Defaults to true
if not provided.
FAQs
CLI utility for Mock-server client. Allows for easy creation/deletion of expectations on the Mock-server instance.
The npm package @bednarik_radek/mockserver-cli receives a total of 4 weekly downloads. As such, @bednarik_radek/mockserver-cli popularity was classified as not popular.
We found that @bednarik_radek/mockserver-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.