This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch 211-update-2 in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 1d2c39ae0b6493040bdb2140b29fba6402299e27 Author: Eric Avdey <[email protected]> AuthorDate: Mon Oct 30 14:07:57 2017 -0300 Return error 410 on temporary view request --- src/chttpd/src/chttpd_view.erl | 2 +- test/javascript/tests/view_errors.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl index 52c96cd..0aaa849 100644 --- a/src/chttpd/src/chttpd_view.erl +++ b/src/chttpd/src/chttpd_view.erl @@ -82,7 +82,7 @@ handle_view_req(Req, _Db, _DDoc) -> handle_temp_view_req(Req, _Db) -> Msg = <<"Temporary views are not supported in CouchDB">>, - chttpd:send_error(Req, 403, forbidden, Msg). + chttpd:send_error(Req, 410, gone, Msg). diff --git a/test/javascript/tests/view_errors.js b/test/javascript/tests/view_errors.js index 0d9cd79..dd60292 100644 --- a/test/javascript/tests/view_errors.js +++ b/test/javascript/tests/view_errors.js @@ -185,6 +185,18 @@ couchTests.view_errors = function(debug) { T(e.error == "query_parse_error"); T(e.reason.match(/no rows can match/i)); } + + // querying a temporary view should give "gone" error message + var xhr = CouchDB.request("POST", "/" + db_name + "/_temp_view", { + headers: {"Content-Type": "application/json"}, + body: JSON.stringify({language: "javascript", + map : "function(doc){emit(doc.integer)}" + }) + }); + T(xhr.status == 410); + result = JSON.parse(xhr.responseText); + T(result.error == "gone"); + T(result.reason == "Temporary views are not supported in CouchDB"); // }); // cleanup -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
