diff options
author | Gavin Carr <gavin@openfusion.com.au> | 2010-09-01 20:42:28 +0100 |
---|---|---|
committer | Gavin Carr <gavin@openfusion.com.au> | 2010-09-01 20:42:28 +0100 |
commit | 3e5e36fe77ed76244061e667cb7289acfb4bd003 (patch) | |
tree | 6e42c2efe2e496d2ced2b3e60a596e5cf2607efe /lib/Net/Riak/Object.pm | |
parent | minor perldoc tweaks to Bucket (diff) | |
download | net-riak-3e5e36fe77ed76244061e667cb7289acfb4bd003.tar.gz |
encode/decode to/from json iff content_type is json
Diffstat (limited to 'lib/Net/Riak/Object.pm')
-rw-r--r-- | lib/Net/Riak/Object.pm | 7 |
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')); } } |