You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2011/10/29 20:59:52 UTC
[1/3] git commit: Allow OPTIONS HTTP method for list requests.
Updated Branches:
refs/heads/1.1.x 62cabfcf2 -> aa7650589
refs/heads/1.2.x 5dfe9a111 -> 6e077c302
refs/heads/master 3b37d17d1 -> 9f53704af
Allow OPTIONS HTTP method for list requests.
Closes COUCHDB-1097
Patch by Omar Yasin.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/aa765058
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/aa765058
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/aa765058
Branch: refs/heads/1.1.x
Commit: aa76505899c789dc54cd23e0fdc67fe4a0cd420f
Parents: 62cabfc
Author: Jan Lehnardt <ja...@apache.org>
Authored: Sat Oct 29 20:59:20 2011 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Sat Oct 29 20:59:40 2011 +0200
----------------------------------------------------------------------
THANKS | 1 +
share/www/script/test/list_views.js | 4 ++++
src/couchdb/couch_httpd_show.erl | 13 ++++++++-----
3 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/aa765058/THANKS
----------------------------------------------------------------------
diff --git a/THANKS b/THANKS
index 58cc144..bd1d42b 100644
--- a/THANKS
+++ b/THANKS
@@ -84,5 +84,6 @@ suggesting improvements or submitting changes. Some of these people are:
* Christopher Bonhage <qu...@me.com>
* Christian Carter <cd...@gmail.com>
* Lukasz Mielicki <mi...@gmail.com>
+ * Omar Yasin <om...@gmail.com>
For a list of authors see the `AUTHORS` file.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/aa765058/share/www/script/test/list_views.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js
index 2c1ac32..cd39b17 100644
--- a/share/www/script/test/list_views.js
+++ b/share/www/script/test/list_views.js
@@ -204,6 +204,10 @@ couchTests.list_views = function(debug) {
T(xhr.status == 200, "standard get should be 200");
T(/head0123456789tail/.test(xhr.responseText));
+ // standard options
+ var xhr = CouchDB.request("OPTIONS", "/test_suite_db/_design/lists/_list/basicBasic/basicView");
+ T(xhr.status == 200, "standard get should be 200");
+ T(/head0123456789tail/.test(xhr.responseText));
// test that etags are available
var etag = xhr.getResponseHeader("etag");
http://git-wip-us.apache.org/repos/asf/couchdb/blob/aa765058/src/couchdb/couch_httpd_show.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl
index 58f046e..b264c37 100644
--- a/src/couchdb/couch_httpd_show.erl
+++ b/src/couchdb/couch_httpd_show.erl
@@ -151,18 +151,21 @@ send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId) ->
% view-list request with view and list from same design doc.
-handle_view_list_req(#httpd{method='GET',
- path_parts=[_, _, DesignName, _, ListName, ViewName]}=Req, Db, DDoc) ->
+handle_view_list_req(#httpd{method=Method,
+ path_parts=[_, _, DesignName, _, ListName, ViewName]}=Req, Db, DDoc)
+ when Method =:= 'GET' orelse Method =:= 'OPTIONS' ->
Keys = couch_httpd:qs_json_value(Req, "keys", nil),
handle_view_list(Req, Db, DDoc, ListName, {DesignName, ViewName}, Keys);
% view-list request with view and list from different design docs.
-handle_view_list_req(#httpd{method='GET',
- path_parts=[_, _, _, _, ListName, ViewDesignName, ViewName]}=Req, Db, DDoc) ->
+handle_view_list_req(#httpd{method=Method,
+ path_parts=[_, _, _, _, ListName, ViewDesignName, ViewName]}=Req, Db, DDoc)
+ when Method =:= 'GET' orelse Method =:= 'OPTIONS' ->
Keys = couch_httpd:qs_json_value(Req, "keys", nil),
handle_view_list(Req, Db, DDoc, ListName, {ViewDesignName, ViewName}, Keys);
-handle_view_list_req(#httpd{method='GET'}=Req, _Db, _DDoc) ->
+handle_view_list_req(#httpd{method=Method}=Req, _Db, _DDoc)
+ when Method =:= 'GET' orelse Method =:= 'OPTIONS' ->
send_error(Req, 404, <<"list_error">>, <<"Invalid path.">>);
handle_view_list_req(#httpd{method='POST',