eiri closed pull request #933: Return error 410 on temporary view request
URL: https://github.com/apache/couchdb/pull/933
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl
index 52c96cd3b8..0aaa849a55 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 0d9cd79fb5..dd60292a36 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
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services