couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Re: Allow overridden request methods
Date Thu, 14 May 2009 07:26:08 GMT
On Wed, May 13, 2009 at 06:58:47PM +0200, Jan Lehnardt wrote:
>> Sorry for responding to my original message instead of a reply in the
>> thread, but I seem to be having some issues with the mailing list.
>> Oliver, you are right, I could use a javascript wrapper for flash. The
>> problem with that is that it introduces a second dependency to
>> interact with the REST interface.
> It adds a second API and complexity to CouchDB to support
> non-standard clients. I.e: If you don't speak HTTP, you can't
> talk to CouchDB.

I think you'll find this is extremely common; many clients especially don't
implement DELETE.

The way Rails deals with it is to allow a form POST to have a _method field,
and if it's present, it takes precedence over the HTTP method.

          method_tag = tag('input', :type => 'hidden', :name => '_method', :value =>

Of course, CouchDB doesn't take a application/x-www-form-urlencoded, it
takes an application/json body. So I think the nearest equivalent would be
to allow a "_method" member in the JSON body and honour it for all POST
requests [with JSON bodies]. Conveniently, CouchDB has already reserved all
top-level keys beginning with underscores for its own purposes.



View raw message