Adding changelog entries
[catagits/Catalyst-Action-REST.git] / lib / Catalyst / Controller / REST.pm
index 9547326..6123010 100644 (file)
@@ -170,13 +170,14 @@ Will do the trick nicely.
 
 =back
 
-By default, L<Catalyst::Controller::REST> will return a C<415 Unsupported Media Type> response if an attempt to use an unsupported content-type is made.  You
-can ensure that something is always returned by setting the C<default> config
-option:
+By default, L<Catalyst::Controller::REST> will return a C<415 Unsupported Media Type>
+response if an attempt to use an unsupported content-type is made.  You
+can ensure that something is always returned by setting the C<default>
+config option:
 
-   __PACKAGE__->config->{'serialize'}->{'default'} = 'YAML';
+   __PACKAGE__->config->{'default'} = 'text/x-yaml';
 
-Would make it always fall back to YAML.
+Would make it always fall back to the serializer plugin defined for text/x-yaml.
 
 Implementing new Serialization formats is easy!  Contributions
 are most welcome!  See L<Catalyst::Action::Serialize> and
@@ -212,7 +213,6 @@ use Params::Validate qw(:all);
 __PACKAGE__->mk_accessors(qw(serialize));
 
 __PACKAGE__->config(
-    serialize => {
         'stash_key' => 'rest',
         'map'       => {
             'text/html'          => 'YAML::HTML',
@@ -227,7 +227,6 @@ __PACKAGE__->config(
             'text/x-config-general' => [ 'Data::Serializer', 'Config::General' ],
             'text/x-php-serialization' => [ 'Data::Serializer', 'PHP::Serialization' ],
         },
-    }
 );
 
 sub begin : ActionClass('Deserialize') {
@@ -350,7 +349,7 @@ sub status_bad_request {
     my %p    = validate( @_, { message => { type => SCALAR }, }, );
 
     $c->response->status(400);
-    $c->log->debug( "Status Bad Request: " . $p{'message'} );
+    $c->log->debug( "Status Bad Request: " . $p{'message'} ) if $c->debug;
     $self->_set_entity( $c, { error => $p{'message'} } );
     return 1;
 }
@@ -376,7 +375,7 @@ sub status_not_found {
     my %p    = validate( @_, { message => { type => SCALAR }, }, );
 
     $c->response->status(404);
-    $c->log->debug( "Status Not Found: " . $p{'message'} );
+    $c->log->debug( "Status Not Found: " . $p{'message'} ) if $c->debug;
     $self->_set_entity( $c, { error => $p{'message'} } );
     return 1;
 }
@@ -386,7 +385,7 @@ sub _set_entity {
     my $c      = shift;
     my $entity = shift;
     if ( defined($entity) ) {
-        $c->stash->{ $self->config->{'serialize'}->{'stash_key'} } = $entity;
+        $c->stash->{ $self->{'stash_key'} } = $entity;
     }
     return 1;
 }