couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r758723 - in /couchdb/trunk: share/www/script/test/basics.js src/couchdb/couch_httpd_db.erl
Date Thu, 26 Mar 2009 16:28:32 GMT
Author: jan
Date: Thu Mar 26 16:28:21 2009
New Revision: 758723

URL: http://svn.apache.org/viewvc?rev=758723&view=rev
Log:
return Location header for newly create databases

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=758723&r1=758722&r2=758723&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/basics.js (original)
+++ couchdb/trunk/share/www/script/test/basics.js Thu Mar 26 16:28:21 2009
@@ -28,6 +28,12 @@
     T(xhr.status == 412);
     if (debug) debugger;
 
+    // creating a new DB should return Location header
+    xhr = CouchDB.request("DELETE", "/new-db");
+    xhr = CouchDB.request("PUT", "/new-db");
+    TEquals("/new-db", xhr.getResponseHeader("Location"),
+      "should return newly created database name in location header");
+
     // Get the database info, check the db_name
     T(db.info().db_name == "test_suite_db");
 

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=758723&r1=758722&r2=758723&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Thu Mar 26 16:28:21 2009
@@ -56,7 +56,7 @@
     case couch_server:create(DbName, [{user_ctx, UserCtx}]) of
     {ok, Db} ->
         couch_db:close(Db),
-        send_json(Req, 201, {[{ok, true}]});
+        send_json(Req, 201, [{"Location", "/" ++ DbName}], {[{ok, true}]});
     Error ->
         throw(Error)
     end.



Mime
View raw message