You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Alexander Shorin (JIRA)" <ji...@apache.org> on 2013/06/26 01:20:20 UTC
[jira] [Updated] (COUCHDB-688) Allow status codes other than 401
and 403 thrown from validate_update_doc function
[ https://issues.apache.org/jira/browse/COUCHDB-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexander Shorin updated COUCHDB-688:
-------------------------------------
Component/s: View Server Support
> Allow status codes other than 401 and 403 thrown from validate_update_doc function
> ----------------------------------------------------------------------------------
>
> Key: COUCHDB-688
> URL: https://issues.apache.org/jira/browse/COUCHDB-688
> Project: CouchDB
> Issue Type: Improvement
> Components: View Server Support
> Reporter: Isaac Z. Schlueter
> Priority: Minor
>
> It would be good to be able to send a response other than 401 or 403 from the validate_update_doc function. Occasionally, a web application built on top of couch may have more subtle semantics than those afforded by these two options.
> For instance, a user may attempt to post a version into a package management registry web-app built on couch. While "unicorn" is a perfectly understandable json string by couchdb, it's not a parseable or valid semver version. I'd like in that case to return a 400 "bad request", because the client sent a request body that this resource could not understand.
> Additionally, there may be cases where a "conflict" is somewhat more broadly understood than couch's _rev matching, and a 409 might be appropriate.
> Proposal: Allow validate_update_doc to specify an HTTP error code like so:
> throw { code : 403, message : "Unauthorized access to foo" }
> throw { code : 410 } // generic message for this status code
> etc.
> in addition to the current:
> throw { unauthorized : "reason" }
> throw { forbidden : "reason" }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira