couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r689996 - in /incubator/couchdb/branches/json_term_changes: share/www/script/couch_tests.js src/couchdb/couch_httpd.erl
Date Thu, 28 Aug 2008 21:28:06 GMT
Author: damien
Date: Thu Aug 28 14:28:06 2008
New Revision: 689996

URL: http://svn.apache.org/viewvc?rev=689996&view=rev
Log:
Fix for missing document ID when creating new documents view bulk post, and fix the welcome
message.

Modified:
    incubator/couchdb/branches/json_term_changes/share/www/script/couch_tests.js
    incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl

Modified: incubator/couchdb/branches/json_term_changes/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/json_term_changes/share/www/script/couch_tests.js?rev=689996&r1=689995&r2=689996&view=diff
==============================================================================
--- incubator/couchdb/branches/json_term_changes/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/branches/json_term_changes/share/www/script/couch_tests.js [utf-8] Thu
Aug 28 14:28:06 2008
@@ -14,6 +14,9 @@
 
   // Do some basic tests.
   basics: function(debug) {
+    var result = JSON.parse(CouchDB.request("GET", "/").responseText);
+    T(result.couchdb == "Welcome"); 
+    
     var db = new CouchDB("test_suite_db");
     db.deleteDb();
 
@@ -311,6 +314,15 @@
     for (i = 0; i < 5; i++) {
       T(db.open(docs[i]._id) == null);
     }
+    
+    // verify creating a document with no id returns a new id
+    var req = CouchDB.request("POST", "/test_suite_db/_bulk_docs", {
+      body: JSON.stringify({"docs": [{"foo":"bar"}]})
+    });
+    result = JSON.parse(req.responseText);
+    
+    T(result.new_revs[0].id != "");
+    T(result.new_revs[0].rev != "");
   },
 
   // test saving a semi-large quanitity of documents and do some view queries.

Modified: incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl?rev=689996&r1=689995&r2=689996&view=diff
==============================================================================
--- incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl Thu Aug 28 14:28:06
2008
@@ -149,8 +149,8 @@
 
 handle_welcome_request(Req, 'GET') ->
     send_json(Req, {[
-        {"couchdb", "Welcome"},
-        {"version", couch_server:get_version()}
+        {couchdb, <<"Welcome">>},
+        {version, list_to_binary(couch_server:get_version())}
     ]});
 
 handle_welcome_request(_Req, _Method) ->
@@ -266,7 +266,7 @@
             fun({ObjProps} = JsonObj) ->
                 Doc = couch_doc:from_json_obj(JsonObj),
                 Id = case Doc#doc.id of
-                    "" -> couch_util:new_uuid();
+                    <<>> -> couch_util:new_uuid();
                     Id0 -> Id0
                 end,
                 Revs = case proplists:get_value(<<"_rev">>, ObjProps) of



Mime
View raw message