1
0
Fork 0

fixed invalid object access, added a test (#2862)

This commit is contained in:
Jan 2017-07-25 22:26:51 +02:00 committed by Frank Celler
parent 1addb727ed
commit 5e1813c5d6
2 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,16 @@ describe ArangoDB do
doc.parsed_response['code'].should eq(400)
end
it "returns an error for an invalid path" do
cmd = api + "/foo"
body = "{ \"query\" : \"RETURN 1\" }"
doc = ArangoDB.log_post("#{prefix}-invalid-path", cmd, :body => body)
doc.code.should eq(404)
doc.headers['content-type'].should eq("application/json; charset=utf-8")
doc.parsed_response['error'].should eq(true)
doc.parsed_response['code'].should eq(404)
end
it "returns an error if collection is unknown" do
cmd = api
body = "{ \"query\" : \"FOR u IN unknowncollection LIMIT 2 RETURN u.n\" }"

View File

@ -40,8 +40,8 @@ function post_api_explain (req, res) {
if (req.suffix.length !== 0) {
actions.resultNotFound(req,
res,
ERRORS.errors.ERROR_HTTP_NOT_FOUND.code,
ERRORS.errors.ERROR_HTTP_NOT_FOUND.message);
ERRORS.ERROR_HTTP_NOT_FOUND.code,
ERRORS.ERROR_HTTP_NOT_FOUND.message);
return;
}