couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1094032 - in /couchdb/branches/1.0.x: share/www/script/test/list_views.js src/couchdb/couch_httpd_external.erl
Date Sat, 16 Apr 2011 19:19:56 GMT
Author: jan
Date: Sat Apr 16 19:19:56 2011
New Revision: 1094032

URL: http://svn.apache.org/viewvc?rev=1094032&view=rev
Log:
Don't call mochiweb_util:parse_qs/1 with an undefined argument.

Found this while debugging COUCHDB-1116.

Closes COUCHDB-1116

Modified:
    couchdb/branches/1.0.x/share/www/script/test/list_views.js
    couchdb/branches/1.0.x/src/couchdb/couch_httpd_external.erl

Modified: couchdb/branches/1.0.x/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/share/www/script/test/list_views.js?rev=1094032&r1=1094031&r2=1094032&view=diff
==============================================================================
--- couchdb/branches/1.0.x/share/www/script/test/list_views.js (original)
+++ couchdb/branches/1.0.x/share/www/script/test/list_views.js Sat Apr 16 19:19:56 2011
@@ -425,4 +425,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");
 };

Modified: couchdb/branches/1.0.x/src/couchdb/couch_httpd_external.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_httpd_external.erl?rev=1094032&r1=1094031&r2=1094032&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_httpd_external.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_httpd_external.erl Sat Apr 16 19:19:56 2011
@@ -65,7 +65,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,



Mime
View raw message