On 26.03.2009, at 17:28, [email protected] wrote:
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

[snip]

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.

The Location header value should be an absolute URI including schema and host. I think there's a function somewhere in couch_httpd.erl to make relative URIs absolute.

Cheers,
--
Christopher Lenz
  cmlenz at gmx.de
  http://www.cmlenz.net/

Reply via email to