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:
21
server/core/test/rest-api/test/errors.js
Normal file
21
server/core/test/rest-api/test/errors.js
Normal 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)
|
||||
});
|
Reference in New Issue
Block a user