diff options
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | share/www/script/test/view_errors.js | 9 | ||||
-rw-r--r-- | src/couchdb/couch_httpd_view.erl | 5 |
3 files changed, 10 insertions, 5 deletions
@@ -26,5 +26,6 @@ suggesting improvements or submitting changes. Some of these people are: * Maarten Thibaut <mthibaut@cisco.com> * Florian Ebeling <florian.ebeling@gmail.com> * Volker Mische <volker.mische@gmail.com> + * Brian Candler <B.Candler@pobox.com> For a list of authors see the `AUTHORS` file. diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js index b9a6aa63..12225e67 100644 --- a/share/www/script/test/view_errors.js +++ b/share/www/script/test/view_errors.js @@ -50,6 +50,15 @@ couchTests.view_errors = function(debug) { }); 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 { diff --git a/src/couchdb/couch_httpd_view.erl b/src/couchdb/couch_httpd_view.erl index 7907f68f..9b1f3617 100644 --- a/src/couchdb/couch_httpd_view.erl +++ b/src/couchdb/couch_httpd_view.erl @@ -78,11 +78,6 @@ handle_view_req(Req, _Db) -> 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, {[]}), |