summary refs log tree commit diff
diff options
context:
space:
mode:
authorGavin Carr <gavin@openfusion.com.au>2010-09-01 20:42:28 +0100
committerGavin Carr <gavin@openfusion.com.au>2010-09-01 20:42:28 +0100
commit3e5e36fe77ed76244061e667cb7289acfb4bd003 (patch)
tree6e42c2efe2e496d2ced2b3e60a596e5cf2607efe
parentminor perldoc tweaks to Bucket (diff)
downloadnet-riak-3e5e36fe77ed76244061e667cb7289acfb4bd003.tar.gz
encode/decode to/from json iff content_type is json
-rw-r--r--lib/Net/Riak/Object.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Net/Riak/Object.pm b/lib/Net/Riak/Object.pm
index c32ea53..0dc6a83 100644
--- a/lib/Net/Riak/Object.pm
+++ b/lib/Net/Riak/Object.pm
@@ -75,7 +75,7 @@ sub store {
         $request->header('link' => $self->_links_to_header);
     }
 
-    if ($self->_jsonize) {
+    if (ref $self->data && $self->content_type eq 'application/json') {
         $request->content(JSON::encode_json($self->data));
     }
     else {
@@ -165,8 +165,9 @@ sub populate {
         $self->siblings(\@siblings);
     }
 
-    if ($status == 200 && $self->_jsonize) {
-        $self->data(JSON::decode_json($self->data));
+    if ($status == 200) {
+        $self->data(JSON::decode_json($self->data))
+            if $self->content_type eq 'application/json';
         $self->vclock($http_response->header('X-Riak-Vclock'));
     }
 }