minimo
Mini Mock server
Rack based REST corresponding server
Install
gem install minimo
Usage
It is placed in the directory you specify a response file.
For example, in the case of the json response to the POST method.
To place the json file in response/POST/hello/world.json
.
$ mkdir -p response/POST/hello
$ cd response/POST/hello
$ vi world.json
{
"hello": "world"
}
To start the minimo server.
require 'minimo'
set :fixture_path, File.dirname( __FILE__ ) + '/response'
set :log_dir, File.dirname( __FILE__ ) + '/log'
set :headers, { 'Vary' => 'Accept-Encoding' }
Rack::Handler::WEBrick.run minimo::Application, Port: 9292
And run the POST method.
$ curl -X POST http://localhost:9292/hello/world/ -d "{ hey: 'ok' }"
{
"hello": "world"
}
You can check the log file
$ cat log/minimo.log
- -> /hello/world/
::1 - - [14/Jul/2016:21:45:17 JST] "POST /hello/world/ HTTP/1.1" 201 16
Other
The response can be created json, xml, in the text.
In addition to the POST, HEAD, PUT, corresponds to DELETE.
$ curl -X GET http://localhost:9292/hello/world/
$ curl -I http://localhost:9292/hello/world/
$ curl -X PUT http://localhost:9292/hello/world/
$ curl -X DELETE http://localhost:9292/hello/world/
Contributing
Contributions to this gem are always welcome :smile:
See CONTRIBUTING for more information on how to get started.
License
This project is licensed under the terms of the MIT license. See the LICENSE file.