Dancer::Plugin::Fake::Response - The great new Dancer::Plugin::Fake::Response!
Version 0.03
in your Dancer project, use this plugin and register :
package MyDancer::Server; use Dancer::Plugin::Fake::Response; catch_fake_exception();
In your config file :
plugins: Fake::Response: GET: "/rewrite_fake_route/:id.:format": response: id: ":id" test: "get test" "/rewrite_fake_route2/:id.:format": response: id: 2 test: "get test 2" PUT: "/rewrite_fake_route/:id.:format": response: id: ":id" test: "put test" POST: "/rewrite_fake_route/:format": response: id: 4 test: "post test" DELETE: "/rewrite_fake_route/:id.:format": response: id: ":id" test: "delete test"
For each defined route in Dancer plugin config are catched and return data and code configured.
For example for : GET http://localhost/rewrite_fake_route/12.json return code : 200 return body : {"id":12,"test":"get test"}
In configuation, if you put parameter name with ':' before, it will return value of parameter send.
new step : * add possibility to return params set like id : :id * add possibility to request data store in a file like response_file: file/get_answer.json
Each route configured in dancer plugin configuration are declare fakly.
Before filter for dancer
Catch if route match with configured route to answer fake data.
Codes return are : - 200 for GET - 201 for POST - 202 for PUT - 202 for DELETE
Nicolas Oudard, <noudard at weborama.com>
<noudard at weborama.com>
Please report any bugs or feature requests to bug-dancer-plugin-fake-response at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer-Plugin-Fake-Response. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-dancer-plugin-fake-response at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Dancer::Plugin::Fake::Response
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dancer-Plugin-Fake-Response
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Dancer-Plugin-Fake-Response
CPAN Ratings
http://cpanratings.perl.org/d/Dancer-Plugin-Fake-Response
Search CPAN
http://search.cpan.org/dist/Dancer-Plugin-Fake-Response/
Copyright 2011 Nicolas Oudard.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Dancer::Plugin::Fake::Response, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::Fake::Response
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::Fake::Response
For more information on module installation, please visit the detailed CPAN module installation guide.