[
https://issues.apache.org/jira/browse/COUCHDB-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul Joseph Davis updated COUCHDB-688:
--------------------------------------
Skill Level: Regular Contributors Level (Easy to Medium)
> 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
> 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.
-
You can reply to this email to add a comment to the issue online.