You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Christopher Lenz <cm...@gmx.de> on 2009/03/26 18:47:17 UTC

Re: svn commit: r758723 - in /couchdb/trunk: share/www/script/test/basics.js src/couchdb/couch_httpd_db.erl

On 26.03.2009, at 17:28, jan@apache.org 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/


Re: svn commit: r758723 - in /couchdb/trunk: share/www/script/test/basics.js src/couchdb/couch_httpd_db.erl

Posted by Jan Lehnardt <ja...@apache.org>.
On 26 Mar 2009, at 18:47, Christopher Lenz wrote:
>>
>> +        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.

Good catch, will fix.

Cheers
Jan
--


Re: svn commit: r758723 - in /couchdb/trunk: share/www/script/test/basics.js src/couchdb/couch_httpd_db.erl

Posted by Jan Lehnardt <ja...@apache.org>.
On 26 Mar 2009, at 18:47, Christopher Lenz wrote:
>>
>
> 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.

fixed in r758942, thanks again!

Cheers
Jan
--