couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r756948 - in /couchdb/trunk: share/www/script/test/basics.js src/couchdb/couch_httpd_db.erl
Date Sat, 21 Mar 2009 14:18:46 GMT
Author: jchris
Date: Sat Mar 21 14:18:46 2009
New Revision: 756948

URL: http://svn.apache.org/viewvc?rev=756948&view=rev
Log:
provide a 404 response on deletion of non-existant docs
closes COUCHDB-297

Modified:
    couchdb/trunk/share/www/script/test/basics.js
    couchdb/trunk/src/couchdb/couch_httpd_db.erl

Modified: couchdb/trunk/share/www/script/test/basics.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/basics.js?rev=756948&r1=756947&r2=756948&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/basics.js (original)
+++ couchdb/trunk/share/www/script/test/basics.js Sat Mar 21 14:18:46 2009
@@ -141,4 +141,8 @@
     var locs = loc.split('/');
     T(locs[4] == resp.id);
     T(locs[3] == "test_suite_db");    
+    
+    // deleting a non-existent doc should be 404
+    xhr = CouchDB.request("DELETE", "/test_suite_db/doc-does-not-exist");
+    T(xhr.status == 404);    
   };

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=756948&r1=756947&r2=756948&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Sat Mar 21 14:18:46 2009
@@ -423,6 +423,8 @@
 
 
 db_doc_req(#httpd{method='DELETE'}=Req, Db, DocId) ->
+    % check for the existence of the doc to handle the 404 case.
+    couch_doc_open(Db, DocId, nil, []),
     case couch_httpd:qs_value(Req, "rev") of
     undefined ->
         update_doc(Req, Db, DocId, {[{<<"_deleted">>,true}]});



Mime
View raw message