summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-10-24 17:42:22 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-10-24 17:42:22 +0000
commit6dab6744c77a1f044017e0b79573185264f7bb09 (patch)
treeae208e621b0b5f363b6d23bc77af65ae41f3695f /src/couchdb
parenta883c9aa32f00b10b85dfeefbb0dcb5b890c231a (diff)
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
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_httpd_show.erl15
1 files changed, 4 insertions, 11 deletions
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.">>).