couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominic Barnes (JIRA)" <j...@apache.org>
Subject [jira] [Created] (COUCHDB-1488) Allow Validation Functions to Modify Response
Date Thu, 31 May 2012 15:33:22 GMT
Dominic Barnes created COUCHDB-1488:
---------------------------------------

             Summary: Allow Validation Functions to Modify Response
                 Key: COUCHDB-1488
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1488
             Project: CouchDB
          Issue Type: New Feature
          Components: Database Core
    Affects Versions: 1.2
            Reporter: Dominic Barnes
             Fix For: 1.3


I would like some way for a validation function to modify the response headers, in my case
to issue a redirect to a browser.

My use-case is that I'm trying to build a CouchApp, but I'm not just creating a single-page
JS application. I'm using shows/lists/attachments/etc to have the application operate without
the client-side JS requirement.

I'm thinking this can be accomplished by simply appending fields to the thrown error object
that would coincide with the response object anywhere else. In addition, since the validation
function runs after an update-handler, this would override anything being set there. (which
makes the most sense)

For example:

if (!newDoc.title) {
   throw {
      code: 303,
      headers: {
         location: "/form?message=Title Required"
      }
   };
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message