summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-12-01 15:47:24 +0100
committerfranck cuny <franck@lumberjaph.net>2011-07-26 13:18:48 +0200
commit12fd8953972f47d3a75bb35ec12336a64ec7c110 (patch)
treebc4b90289840bca6c6c3fd1057c6ba83cdd94071
parentMerge pull request #8 from stevan/master (diff)
downloadnet-http-spore-12fd8953972f47d3a75bb35ec12336a64ec7c110.tar.gz
fix a problem when decoding serialized content when not needed
-rw-r--r--lib/Net/HTTP/Spore/Middleware/Format.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Net/HTTP/Spore/Middleware/Format.pm b/lib/Net/HTTP/Spore/Middleware/Format.pm
index 2741295..1fd5ce5 100644
--- a/lib/Net/HTTP/Spore/Middleware/Format.pm
+++ b/lib/Net/HTTP/Spore/Middleware/Format.pm
@@ -54,8 +54,9 @@ sub call {
         sub {
             my $res = shift;
             if ( $res->body ) {
-                my $content = $self->decode( $res->body );
+                return if $res->code >= 500;
                 return unless $self->should_deserialize( $res->env );
+                my $content = $self->decode( $res->body );
                 $res->body($content);
                 $res->env->{ $self->deserializer_key } = 1;
             }