couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Isaac Z. Schlueter (JIRA)" <j...@apache.org>
Subject [jira] Created: (COUCHDB-688) Allow status codes other than 401 and 403 thrown from validate_update_doc function
Date Thu, 11 Mar 2010 05:35:27 GMT
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.


Mime
View raw message