Permalink
Browse files

Allow OPTIONS HTTP method for list requests.

Closes COUCHDB-1097

Patch by Omar Yasin.
  • Loading branch information...
1 parent 3b37d17 commit 9f53704af06c8eeffb0b47a526a3777bb33c737a @janl janl committed Oct 29, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −0 THANKS
  2. +4 −0 share/www/script/test/list_views.js
  3. +2 −1 src/couch_mrview/src/couch_mrview_show.erl
View
1 THANKS
@@ -90,5 +90,6 @@ suggesting improvements or submitting changes. Some of these people are:
* Christopher Bonhage <queezey@me.com>
* Christian Carter <cdcarter@gmail.com>
* Lukasz Mielicki <mielicki@gmail.com>
+ * Omar Yasin <omarkj@gmail.com>
For a list of authors see the `AUTHORS` file.
View
4 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");
View
3 src/couch_mrview/src/couch_mrview_show.erl
@@ -154,7 +154,8 @@ send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId) ->
couch_httpd_external:send_external_response(Req, JsonResp).
-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' ->
case Req#httpd.path_parts of
[_, _, _DName, _, LName, VName] ->
% Same design doc for view and list

0 comments on commit 9f53704

Please sign in to comment.