You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Dominic Barnes (JIRA)" <ji...@apache.org> on 2012/05/31 17:33:22 UTC

[jira] [Created] (COUCHDB-1488) Allow Validation Functions to Modify Response

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

        

[jira] [Resolved] (COUCHDB-1488) Allow Validation Functions to Modify Response

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1488?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson resolved COUCHDB-1488.
------------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 1.3)

Sorry, not happening. This would mess with replication.
                
> 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
>              Labels: api-change
>
> 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