You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Cliff Stanford (JIRA)" <ji...@apache.org> on 2010/02/09 22:50:28 UTC
[jira] Created: (COUCHDB-648) _update handler ignores "code" in
response doc
_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
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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-648) _update handler ignores "code" in
response doc
Posted by "Taras Puchko (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907230#action_12907230 ]
Taras Puchko commented on COUCHDB-648:
--------------------------------------
return [null, {code: 400, headers: {"Content-Type" : "text/plain"}, body: "Client Error"}] results in "HTTP/1.1 200 OK" instead of 400.
> _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
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-648) _update handler ignores "code" in
response doc
Posted by "Felix Henninger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12911111#action_12911111 ]
Felix Henninger commented on COUCHDB-648:
-----------------------------------------
I would like to add that this issue persists when the start() method is used (c.f. http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Sending_a_Redirect ).
As rnewson commented on IRC, the response code is hardcoded for _updates (couch_httpd_show:send_doc_update_response; http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?view=markup#L125), but not for _lists and _shows -- creating consistency here would also be helpful.
In line with the original author, I would personally much appreciate this addition, since it would allow for basic form processing without javascript, and thereby provide graceful degradation for CouchDB-based web apps.
> _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
>
> 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.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COUCHDB-648) _update handler ignores "code" in
response doc
Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Joseph Davis updated COUCHDB-648:
--------------------------------------
Skill Level: New Contributors Level (Easy)
> _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
>
> 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.
-
You can reply to this email to add a comment to the issue online.