NAME

Dancer::Plugin::Fake::Response - The great new Dancer::Plugin::Fake::Response!

VERSION

Version 0.03

SYNOPSIS

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

INIT MODULE ROUTE

Each route configured in dancer plugin configuration are declare fakly.

SUBROUTINES/METHODS

catch_fake_exception

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

AUTHOR

Nicolas Oudard, <noudard at weborama.com>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Dancer::Plugin::Fake::Response

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

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.