You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2010/02/02 18:39:14 UTC
[Couchdb Wiki] Update of "Security_Features_Overview" by jchrisa
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "Security_Features_Overview" page has been changed by jchrisa.
The comment on this change is: fixed validation example.
http://wiki.apache.org/couchdb/Security_Features_Overview?action=diff&rev1=6&rev2=7
--------------------------------------------------
_id: "_design/myview",
validate_doc_update: "function(newDoc, oldDoc, userCtx) {
if(newDoc.address === undefined) {
- throw {missing_field: 'Document must have an address.'};
+ throw {forbidden: 'Document must have an address.'};
}"
}
}}}
The result of a document update without the address field will look like this:
{{{
- HTTP/1.1 401 Unauthorized
+ HTTP/1.1 403 Forbidden
WWW-Authenticate: Basic realm="administrator"
Server: CouchDB/0.9.0 (Erlang OTP/R12B)
Date: Tue, 21 Apr 2009 00:02:32 GMT
@@ -44, +44 @@
Content-Length: 57
Cache-Control: must-revalidate
- {"error":"missing_field","reason":"Document must have an address."}
+ {"error":"forbbiden","reason":"Document must have an address."}
}}}