bumped it!

";
return [doc, message];
},
"error" : function(doc, req) {
superFail.badCrash;
},
"xml" : function(doc, req) {
var xml = new XML('');
xml.title = doc.title;
var posted_xml = new XML(req.body);
doc.via_xml = posted_xml.foo.toString();
var resp = {
"headers" : {
"Content-Type" : "application/xml"
},
"body" : xml
};
return [doc, resp];
}
}
}}}
The handler function takes the document and the http request as parameters. It returns a two-element array: the first element is the (updated) document, which is committed to the database. The second element is the response that will be sent back to the caller.
== Usage ==
To invoke a handler, one must "put" the document against the handler function itself. Using the canonical document URL won't invoke any handlers. For example, to invoke the "in-place" handler defined above, the URL to use is:
{{{
http://127.0.0.1:5984//_design//_update/in-place/?field=title&value=test
}}}
This usage seems to indicate that unlike document validators, the user's intend must be clear by calling an individual handler explicitly.