Skip to content

Commit

Permalink
fix for when content type for json lies
Browse files Browse the repository at this point in the history
  • Loading branch information
randysecrist committed Sep 27, 2013
1 parent 24dc088 commit f757e24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/riak.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,13 @@ function RiakObject(bucketName, key, client, body, contentType, vclock) {
}
if (contentType === 'application/json') {
if (body !== undefined) {
this.body = JSON.parse(body);
try {
this.body = JSON.parse(body);
}
catch (err) {
// the content type lied to us
this.body = body;
}
}
else {
this.body = '';
Expand Down

0 comments on commit f757e24

Please sign in to comment.