You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Jonathan D. Knezek (JIRA)" <ji...@apache.org> on 2011/02/05 09:26:30 UTC

[jira] Updated: (COUCHDB-648) _update handler ignores "code" in response doc

     [ https://issues.apache.org/jira/browse/COUCHDB-648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan D. Knezek updated COUCHDB-648:
---------------------------------------

    Attachment: 0001-Document-update-handlers-now-honor-code-in-response-.patch

I've attached a patch that applies to 1.0.2 (but I think applies cleanly to trunk).

I'm unfortunately not familiar enough (read: at all) with etap to write a test, but the code is quite straightforward.

> _update handler ignores "code" in response doc
> ----------------------------------------------
>
>                 Key: COUCHDB-648
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-648
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>         Environment: CouchDB from HEAD
>            Reporter: Cliff Stanford
>              Labels: update
>         Attachments: 0001-Document-update-handlers-now-honor-code-in-response-.patch
>
>
> When using an _update handler, it should be possible to return a response code.
>   return [ doc, {
>   headers : { "Location" : "/" },
>   code	  : 303,
>   body	  : 'Redirecting'
>   }];
> Should return 303 (the redirect for POST) but in fact, on a successful create returns 201.  This means it is not possible to use the browser to POST as you cannot redirect on return.  This feels like a bug.
> In any case, I would respectfully suggest that the syntax of the _update handler be changed so that there is a store(doc) call (or similar) which returns a JSON object to the update handler so that the handler may redirect appropriately.  That would make it possible to do updates client-side with little or no client-side javascript.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira