MXS-1220: Add more validation checks to request JSON

The requests that send a body should define at least a `data` member.

Added a simple test that checks that bad requests are rejected. This test
should be expanded to check that the returned error body contains the
correct members.
This commit is contained in:
Markus Mäkelä
2017-05-18 15:18:59 +03:00
parent 75e7ac35ed
commit e3c4bd7f72
3 changed files with 38 additions and 5 deletions

View File

@ -0,0 +1,21 @@
require("../utils.js")()
describe("Errors", function()
{
before(startMaxScale)
it("error on invalid PUT request", function()
{
return request.put(base_url + "/servers/server1", { json: {this_is: "a test"}})
.should.be.rejected
})
it("error on invalid POST request", function()
{
return request.post(base_url + "/servers", { json: {this_is: "a test"}})
.should.be.rejected
})
after(stopMaxScale)
});