diff options
-rw-r--r-- | share/www/script/test/list_views.js | 25 | ||||
-rw-r--r-- | src/couchdb/couch_httpd_external.erl | 5 |
2 files changed, 29 insertions, 1 deletions
diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js index e98a212e..2c1ac321 100644 --- a/share/www/script/test/list_views.js +++ b/share/www/script/test/list_views.js @@ -447,4 +447,29 @@ couchTests.list_views = function(debug) { value: "{couch_native_process, start_link, []}" }], erlViewTest); + // COUCHDB-1113 + var ddoc = { + _id: "_design/test", + views: { + me: { + map: (function(doc) { emit(null,null)}).toString() + } + }, + lists: { + you: (function(head, req) { + var row; + while(row = getRow()) { + send(row); + } + }).toString() + } + }; + db.save(ddoc); + + var resp = CouchDB.request("GET", "/" + db.name + "/_design/test/_list/you/me", { + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } + }); + TEquals(200, resp.status, "should return a 200 response"); }; diff --git a/src/couchdb/couch_httpd_external.erl b/src/couchdb/couch_httpd_external.erl index f8d6f171..2e91fb50 100644 --- a/src/couchdb/couch_httpd_external.erl +++ b/src/couchdb/couch_httpd_external.erl @@ -66,7 +66,10 @@ json_req_obj(#httpd{mochi_req=Req, end, ParsedForm = case Req:get_primary_header_value("content-type") of "application/x-www-form-urlencoded" ++ _ -> - mochiweb_util:parse_qs(Body); + case Body of + undefined -> []; + _ -> mochiweb_util:parse_qs(Body) + end; _ -> [] end, |