{"action":"created","issue":{"url":"https://api.github.com/repos/cloudant/CDTDatastore/issues/136","labels_url":"https://api.github.com/repos/cloudant/CDTDatastore/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/cloudant/CDTDatastore/issues/136/comments","events_url":"https://api.github.com/repos/cloudant/CDTDatastore/issues/136/events","html_url":"https://github.com/cloudant/CDTDatastore/pull/136","id":71530279,"number":136,"title":"Validate document body is valid json.","user":{"login":"rhyshort","id":1616727,"avatar_url":"https://avatars.githubusercontent.com/u/1616727?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyshort","html_url":"https://github.com/rhyshort","followers_url":"https://api.github.com/users/rhyshort/followers","following_url":"https://api.github.com/users/rhyshort/following{/other_user}","gists_url":"https://api.github.com/users/rhyshort/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyshort/subscriptions","organizations_url":"https://api.github.com/users/rhyshort/orgs","repos_url":"https://api.github.com/users/rhyshort/repos","events_url":"https://api.github.com/users/rhyshort/events{/privacy}","received_events_url":"https://api.github.com/users/rhyshort/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-28T09:07:51Z","updated_at":"2015-05-11T20:49:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cloudant/CDTDatastore/pulls/136","html_url":"https://github.com/cloudant/CDTDatastore/pull/136","diff_url":"https://github.com/cloudant/CDTDatastore/pull/136.diff","patch_url":"https://github.com/cloudant/CDTDatastore/pull/136.patch"},"body":"Validate document body contains only valid json values\r\nbefore attempting to save.\r\n\r\nBugzID: 42641\r\n\r\nFixes #97\r\n\r\n\r\nreviewer @mikerhodes \r\nreviewer @tomblench "},"comment":{"url":"https://api.github.com/repos/cloudant/CDTDatastore/issues/comments/101043039","html_url":"https://github.com/cloudant/CDTDatastore/pull/136#issuecomment-101043039","issue_url":"https://api.github.com/repos/cloudant/CDTDatastore/issues/136","id":101043039,"user":{"login":"jimix","id":727026,"avatar_url":"https://avatars.githubusercontent.com/u/727026?v=3","gravatar_id":"","url":"https://api.github.com/users/jimix","html_url":"https://github.com/jimix","followers_url":"https://api.github.com/users/jimix/followers","following_url":"https://api.github.com/users/jimix/following{/other_user}","gists_url":"https://api.github.com/users/jimix/gists{/gist_id}","starred_url":"https://api.github.com/users/jimix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimix/subscriptions","organizations_url":"https://api.github.com/users/jimix/orgs","repos_url":"https://api.github.com/users/jimix/repos","events_url":"https://api.github.com/users/jimix/events{/privacy}","received_events_url":"https://api.github.com/users/jimix/received_events","type":"User","site_admin":false},"created_at":"2015-05-11T20:49:26Z","updated_at":"2015-05-11T20:49:26Z","body":"This patch solves the problem for `NAN` and `+/-INFINITY` however storing `DBL_MAX` or `DBL_MIN` will continue to cause no error and an empty body on recall.\r\nHere is a diff that shows the issue:\r\n```diff\r\ndiff --git a/Tests/Tests/DatastoreCRUD.m b/Tests/Tests/DatastoreCRUD.m\r\nindex bdc7db4..9399b90 100644\r\n--- a/Tests/Tests/DatastoreCRUD.m\r\n+++ b/Tests/Tests/DatastoreCRUD.m\r\n@@ -88,11 +88,16 @@\r\n {\r\n     NSError * error;\r\n     CDTMutableDocumentRevision * revision = [CDTMutableDocumentRevision revision];\r\n-    revision.body = @{@\"infinity\":@(INFINITY)};\r\n+    revision.body = @{@\"infinity\":@(DBL_MAX)};\r\n     \r\n     CDTDocumentRevision * rev = [self.datastore createDocumentFromRevision:revision\r\n                                                                      error:&error];\r\n-    \r\n+    if (rev) {\r\n+        CDTDocumentRevision *checkRev = [self.datastore getDocumentWithId:rev.docId error:&error];\r\n+        XCTAssertNotNil(checkRev, \"readback failed\");\r\n+        XCTAssertGreaterThan([checkRev.body count], 0, \"readback empty\");\r\n+    }\r\n+\r\n     XCTAssertNil(rev,@\"revision is not nil\");\r\n     XCTAssertNotNil(error,@\"Error should be set\");\r\n     XCTAssertEqual(400,\r\n```"}}