diff options
author | Eric Avdey <eiri@eiri.ca> | 2017-10-30 14:07:57 -0300 |
---|---|---|
committer | Joan Touzet <wohali@users.noreply.github.com> | 2017-10-31 22:52:10 -0400 |
commit | b5d98788510dabf22651df9f00b3af0d3abaee81 (patch) | |
tree | 03fa98294c850a9009afb8fcb9714542e52aa291 | |
parent | 3aa0470a4d4da698887b6cecaa6272db4545425c (diff) | |
download | couchdb-b5d98788510dabf22651df9f00b3af0d3abaee81.tar.gz |
Return error 410 on temporary view request
-rw-r--r-- | src/chttpd/src/chttpd_view.erl | 2 | ||||
-rw-r--r-- | test/javascript/tests/view_errors.js | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl index 52c96cd3b..0aaa849a5 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 0d9cd79fb..dd60292a3 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 |