[Catalyst-commits] r8059 - in
Catalyst-Action-REST/0.60/branches/decouple_deserialize:
lib/Catalyst/Action t
lukes at dev.catalyst.perl.org
lukes at dev.catalyst.perl.org
Mon Jun 30 19:50:18 BST 2008
Author: lukes
Date: 2008-06-30 19:50:17 +0100 (Mon, 30 Jun 2008)
New Revision: 8059
Modified:
Catalyst-Action-REST/0.60/branches/decouple_deserialize/lib/Catalyst/Action/SerializeBase.pm
Catalyst-Action-REST/0.60/branches/decouple_deserialize/t/catalyst-action-serialize-accept.t
Log:
fixed stuff after pull
Modified: Catalyst-Action-REST/0.60/branches/decouple_deserialize/lib/Catalyst/Action/SerializeBase.pm
===================================================================
--- Catalyst-Action-REST/0.60/branches/decouple_deserialize/lib/Catalyst/Action/SerializeBase.pm 2008-06-30 18:38:56 UTC (rev 8058)
+++ Catalyst-Action-REST/0.60/branches/decouple_deserialize/lib/Catalyst/Action/SerializeBase.pm 2008-06-30 18:50:17 UTC (rev 8059)
@@ -36,12 +36,6 @@
$self->_serialize_plugins( \@plugins );
}
- # carp about old text/x-json
- if ($content_type eq 'text/x-json') {
- $c->log->info('Using deprecated text/x-json content-type.');
- $c->log->info('Use application/json instead!');
- }
-
# Finally, we load the class. If you have a default serializer,
# and we still don't have a content-type that exists in the map,
# we'll use it.
@@ -63,6 +57,7 @@
# the default
my ($content_type) = grep { $map->{$_} } @{$c->request->accepted_content_types};
+
unless ( defined $content_type ) {
if( exists $config->{'default'} ) {
$content_type = $config->{'default'} ;
@@ -71,6 +66,12 @@
}
}
+ # carp about old text/x-json
+ if ($content_type eq 'text/x-json') {
+ $c->log->info('Using deprecated text/x-json content-type.');
+ $c->log->info('Use application/json instead!');
+ }
+
if ( exists( $map->{$content_type} ) ) {
my $mc;
if ( ref( $map->{$content_type} ) eq "ARRAY" ) {
Modified: Catalyst-Action-REST/0.60/branches/decouple_deserialize/t/catalyst-action-serialize-accept.t
===================================================================
--- Catalyst-Action-REST/0.60/branches/decouple_deserialize/t/catalyst-action-serialize-accept.t 2008-06-30 18:38:56 UTC (rev 8058)
+++ Catalyst-Action-REST/0.60/branches/decouple_deserialize/t/catalyst-action-serialize-accept.t 2008-06-30 18:50:17 UTC (rev 8059)
@@ -18,7 +18,7 @@
'stash_key' => 'rest',
'map' => {
'text/x-yaml' => 'YAML',
- 'text/x-json' => 'JSON',
+ 'application/json' => 'JSON',
'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
'text/broken' => 'Broken',
},
@@ -77,12 +77,12 @@
{
my $at = Test::Rest->new('content_type' => 'text/doesnt-exist');
my $req = $at->get(url => '/test');
- $req->header('Accept', 'text/x-json');
+ $req->header('Accept', 'application/json');
my $res = request($req);
ok( $res->is_success, 'GET the serialized request succeeded' );
my $ret = JSON::Syck::Load($res->content);
is( $ret->{lou}, 'is my cat', "Request returned proper data");
- is( $res->header('Content-type'), 'text/x-json', 'Accept header used if content-type mapping not found')
+ is( $res->header('Content-type'), 'application/json', 'Accept header used if content-type mapping not found')
}
# Make sure we don't get a bogus content-type when using default
More information about the Catalyst-commits
mailing list