From 6dab6744c77a1f044017e0b79573185264f7bb09 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sat, 24 Oct 2009 17:42:22 +0000 Subject: Update functions can now handle any HTTP verb, excepting GET and HEAD git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@829419 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_show.erl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/couchdb') diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl index a961033a..19785f5d 100644 --- a/src/couchdb/couch_httpd_show.erl +++ b/src/couchdb/couch_httpd_show.erl @@ -39,8 +39,11 @@ handle_doc_show_req(#httpd{method='GET'}=Req, _Db) -> handle_doc_show_req(Req, _Db) -> send_method_not_allowed(Req, "GET,POST,HEAD"). + +handle_doc_update_req(#httpd{method = 'GET'}=Req, Db) -> + send_method_not_allowed(Req, "POST,PUT,DELETE,ETC"); + handle_doc_update_req(#httpd{ - method = 'PUT', path_parts=[_DbName, _Design, DesignName, _Update, UpdateName, DocId] }=Req, Db) -> DesignId = <<"_design/", DesignName/binary>>, @@ -55,7 +58,6 @@ handle_doc_update_req(#httpd{ send_doc_update_response(Lang, UpdateSrc, DocId, Doc, Req, Db); handle_doc_update_req(#httpd{ - method = 'POST', path_parts=[_DbName, _Design, DesignName, _Update, UpdateName] }=Req, Db) -> DesignId = <<"_design/", DesignName/binary>>, @@ -64,15 +66,6 @@ handle_doc_update_req(#httpd{ UpdateSrc = couch_util:get_nested_json_value({Props}, [<<"updates">>, UpdateName]), send_doc_update_response(Lang, UpdateSrc, nil, nil, Req, Db); -handle_doc_update_req(#httpd{ - path_parts=[_DbName, _Design, _DesignName, _Update, _UpdateName, _DocId] - }=Req, _Db) -> - send_method_not_allowed(Req, "PUT"); - -handle_doc_update_req(#httpd{ - path_parts=[_DbName, _Design, _DesignName, _Update, _UpdateName] - }=Req, _Db) -> - send_method_not_allowed(Req, "POST"); handle_doc_update_req(Req, _Db) -> send_error(Req, 404, <<"update_error">>, <<"Invalid path.">>). -- cgit v1.2.3