You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2009/04/29 16:07:09 UTC

svn commit: r769792 - in /couchdb/trunk: THANKS share/www/script/test/view_errors.js src/couchdb/couch_httpd_view.erl

Author: kocolosk
Date: Wed Apr 29 14:07:09 2009
New Revision: 769792

URL: http://svn.apache.org/viewvc?rev=769792&view=rev
Log:
Closes COUCHDB-320 (ignore Content-Type in _temp_view).  Thanks B. Candler

Modified:
    couchdb/trunk/THANKS
    couchdb/trunk/share/www/script/test/view_errors.js
    couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: couchdb/trunk/THANKS
URL: http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=769792&r1=769791&r2=769792&view=diff
==============================================================================
--- couchdb/trunk/THANKS (original)
+++ couchdb/trunk/THANKS Wed Apr 29 14:07:09 2009
@@ -26,5 +26,6 @@
  * Maarten Thibaut <mt...@cisco.com>
  * Florian Ebeling <fl...@gmail.com>
  * Volker Mische <vo...@gmail.com>
+ * Brian Candler <B....@pobox.com>
 
 For a list of authors see the `AUTHORS` file.

Modified: couchdb/trunk/share/www/script/test/view_errors.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_errors.js?rev=769792&r1=769791&r2=769792&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/view_errors.js (original)
+++ couchdb/trunk/share/www/script/test/view_errors.js Wed Apr 29 14:07:09 2009
@@ -50,6 +50,15 @@
   });
   T(JSON.parse(xhr.responseText).error == "invalid_json");
   
+  // views should ignore Content-Type, like the rest of CouchDB
+  var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view", {
+    headers: {"Content-Type": "application/x-www-form-urlencoded"},
+    body: JSON.stringify({language: "javascript", 
+      map : "function(doc){}"
+    })
+  });
+  T(xhr.status == 200);
+  
   var map = function (doc) {emit(doc.integer, doc.integer);};
   
   try {

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=769792&r1=769791&r2=769792&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Wed Apr 29 14:07:09 2009
@@ -78,11 +78,6 @@
 
 handle_temp_view_req(#httpd{method='POST'}=Req, Db) ->
     couch_stats_collector:increment({httpd, temporary_view_reads}),
-    case couch_httpd:primary_header_value(Req, "content-type") of
-        undefined -> ok;
-        "application/json" -> ok;
-        Else -> throw({incorrect_mime_type, Else})
-    end,
     {Props} = couch_httpd:json_body(Req),
     Language = proplists:get_value(<<"language">>, Props, <<"javascript">>),
     {DesignOptions} = proplists:get_value(<<"options">>, Props, {[]}),