resource params (:id, :format, etc) not properly set #3

merged 1 commit into from Mar 25, 2014


None yet
2 participants

garu commented Mar 25, 2014

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.


garu changed the title from tests for resource params and prepare_serializer_for_format to resource params (:id, :format, etc) not properly set Mar 25, 2014

@yanick yanick added a commit that referenced this pull request Mar 25, 2014

@yanick yanick order of route creation is important
Fixes #3

@yanick yanick merged commit 2351618 into PerlDancer:master Mar 25, 2014

yanick commented Mar 25, 2014

Do'h! Mistake corrected and new release pushed. Thanks!

garu deleted the garu:master branch Mar 25, 2014

garu commented Mar 25, 2014


yanick commented Mar 25, 2014

No, no, no: thank you. That test file was super-useful. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment