Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
On-The-Fly Mock JSON Server
$ npm install -g caddis
$ caddis -h
usage: caddis [action] [port]
Starts a server at http://localhost:<port> as a daemon, exposing an api to post JSON to in order to mock a RESTful service.
Defaults to port 3001 unless --port option provided.
actions:
start Start Caddis at http://localhost:<port>
stop Stop a previously started Caddis daemon
options:
-h Display this help menu
-p Desired port to start server on localhost
$ caddis start
$ curl -X POST -d '{"method":"GET", "uri":"/foo", "response":{"bar":"baz"}}' http://localhost:3001/api --header "Content-Type:application/json"
Visit http://localhost:3001/foo, prints:
{
bar: 'baz'
}
$ caddis stop
Visit http://localhost:3001/foo, Not Found.
A caddis is a moth-like insect often used as models for fly lures in fishing.
The caddis CLI tool is used to start and stop a RESTful JSON service with the ability to POST route configuration and responses, on-the-fly, for mocking and testing purposes.
It may be a stretch, but there's wit in there somewhere...
There are other projects I have been a part of, such as madmin, that allow for dynamically creating RESTful APIs through a User Interface and allows for persistance through I/O.
Recently, I was involved with mocking a service layer for unit testing purposes and found that the manual curation of such an API was too tedious for the task at hand - I wanted the process to be much more fluid and simple.
In this particular instance I needed to:
Fairly simple, and most of all I didnt want any artifacts lying around - in other words I didn't need for any routes that I dynamically created to stick around on my local disk after the tests were done.
As such, caddis was born.
As mentioned briefly above, caddis is a CLI tool. It is recommended to install globally:
$ npm install -g caddis
: you may need to sudo
Once installed, you can start the service (currently defaults to http://localhost:3001) and begin POSTing route configurations in JSON. Here is an example using cUrl that dynamically adds a GET route at /foo
with a simple JSON payload of {"bar":"baz"}
:
$ curl -X POST -d '{"method":"GET", "uri":"/foo", "response":{"bar":"baz"}}' http://localhost:3001/api --header "Content-Type:application/json"
You are not confiuned to cUrl - you can use whatever networking library in whatever language you are writing your tests in and the server can handle all modern RESTful methods:
When you are finished, simply stop the caddis server:
$ caddis stop
The post body data that is sent to caddis has the following properties:
$ npm run test
Copyright (c) 2014 Todd Anderson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Caddis --- > On-The-Fly Mock JSON Server
The npm package caddis receives a total of 2 weekly downloads. As such, caddis popularity was classified as not popular.
We found that caddis 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.