PerlDancer/Dancer-Plugin-REST — pull request #3 by garu (2014-03-25 05:19:05+00:00)
Title: tests for resource params and prepare_serializer_for_format

Hi there!

It looks like the code refactoring on commit 2f64ae1 broke some bits of Dancer::Plugin::REST. In particular, it does not separate the ":format" from the rest of the parameter anymore. Up until the previous commit (d1f74b6), if you had something like:

resource user => get => sub { my $id = params->{id}; my $format = params->{format} };

and you issued a GET '/user/42.json', you'd get $id as '42' and $format as 'json'. On commit 2f64ae1 onwards this does not happen anymore. Instead, you get $id as '42.json' and $format as undef. Since this is not the expected outcome (from both the docs and all the previous versions), I wrote a test case for this, which this commit is all about.

The test passes on d1f74b6 but explodes on 2f64ae1 onwards. I haven't really looked into a fix on Dancer::Plugin::REST itself (I was debugging this on my own API), but I figured the test should give you guys a good head start.

Cheers!