From: Hans Dieter Pearcey Date: Thu, 26 Mar 2009 05:50:58 +0000 (-0400) Subject: take pity on people using the deprecated 'serialize' config key (RT#32342) X-Git-Tag: 0.69~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=commitdiff_plain;h=7b8c5be2c53fb134db3541879c8a1bce5fab2180 take pity on people using the deprecated 'serialize' config key (RT#32342) --- diff --git a/Changes b/Changes index 9568fd7..5a968f0 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +??? + Fix RT#32342, deprecated config loses default map (hdp) + Wed Mar 25 22:33:38 PDT 2009 (hdp) - Release 0.68 Remove prompt for ancient and deprecated Data::Denter from Makefile.PL Remove Data::Dump, which was entirely unused diff --git a/lib/Catalyst/Action/SerializeBase.pm b/lib/Catalyst/Action/SerializeBase.pm index 701e7e9..c742477 100644 --- a/lib/Catalyst/Action/SerializeBase.pm +++ b/lib/Catalyst/Action/SerializeBase.pm @@ -55,6 +55,9 @@ sub _load_content_plugins { $c->log->info("Using deprecated configuration for Catalyst::Action::REST!"); $c->log->info("Please see perldoc Catalyst::Action::REST for the update guide"); $config = $controller->{'serialize'}; + # if they're using the deprecated config, they may be expecting a + # default mapping too. + $config->{map} ||= $controller->{map}; } else { $config = $controller; } diff --git a/t/catalyst-action-serialize.t b/t/catalyst-action-serialize.t index b355440..78ce12b 100644 --- a/t/catalyst-action-serialize.t +++ b/t/catalyst-action-serialize.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 9; use Data::Serializer; use FindBin; @@ -30,5 +30,9 @@ my $res2 = request($t->get(url => '/serialize/test_second')); ok( $res2->is_success, '2nd request succeeded' ); is( $res2->content, "{'lou' => 'is my cat'}", "2nd request returned proper data"); +Test::Catalyst::Action::REST->controller('Serialize')->{serialize} = {}; +$res2 = request($t->get(url => '/serialize/test_second')); +ok( $res2->is_success, 'request succeeded (deprecated config)' ); +is( $res2->content, "{'lou' => 'is my cat'}", "request returned proper data"); 1;