From 36bbc72b6b0992639a0ba7a2077d75ec9f7cf03d Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Tue, 11 Aug 2009 18:50:08 +0000 Subject: Initial commit of _update handler. Thanks to Paul Davis, Jason Davies for code and others for discussion. The _update handler accepts POSTs to paths like: /db/_design/foo/_update/bar and PUTs which include docids, like: /db/_design/foo/_update/bar/docid The function signature: function(doc, req) { doc.a_new_field = req.query.something; return [doc, "

added something to your doc

"]; } The tests in update_documents.js are fairly complete and include examples of bumping a counter, changing only a single field, parsing from (and returning) XML, and creating new documents. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@803245 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/couchdb/couch_httpd.erl') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index fee5004e..fde02317 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -353,7 +353,7 @@ send_response(#httpd{mochi_req=MochiReq}=Req, Code, Headers, Body) -> {ok, MochiReq:respond({Code, Headers ++ server_header() ++ couch_httpd_auth:cookie_auth_header(Req, Headers), Body})}. send_method_not_allowed(Req, Methods) -> - send_response(Req, 405, [{"Allow", Methods}], <<>>). + send_error(Req, 405, [{"Allow", Methods}], <<"method_not_allowed">>, ?l2b("Only " ++ Methods ++ " allowed")). send_json(Req, Value) -> send_json(Req, 200, Value). -- cgit v1.2.3