docker run --rm -p 1080:1080 -itd skotchpine/mockbetter
curl -XPUT localhost:1080/mock/routes -d'{
"method": "GET",
"path": "/how-do",
"code": "200",
"body": {"mock":"better"}
}'
curl localhost:1080/how-do
curl localhost:1080/mock/history
curl localhost:1080/mock/conf
curl -XPUT localhost:1080/mock/conf -d'{
"default": {
"code": "404"
}
}'
curl -XPUT localhost:1080/mock/reset
curl -XPUT localhost:1080/mock/routes -d'{
"path": "/mock",
"method": "GET",
"body": "better",
"code": "200"
}'
curl -XDELETE localhost:1080/mock/routes
curl -XPUT localhost:1080/mock/history
curl -XDELETE localhost:1080/mock/history
curl -XPUT -d'{"default":{"mode":"dump"}' localhost:1080/mock/conf
curl -d'{"say": "hello"}' localhost:1080
200 => { "method": "GET", "path": "/" }
curl -XPUT -d'{"default":{"mode":"echo"}' localhost:1080/mock/conf
curl -d'{"say": "hello"}' localhost:1080
200 => { "say": "hello" }
curl -XPUT -d'{"default":{"mode":"mock","status":"400"}' localhost:1080/mock/conf
curl -d'{"say": "hello"}' localhost:1080
400 => { "message": "mock better" }
git clone https://github.com/skotchpine/mockbetter
cd mockbetter
bundle install
./test