return from handler in empty payload check to prevent error from being thrown

This commit is contained in:
Matthew Bargar 2015-11-17 13:43:41 -05:00
parent a2ba98c360
commit 08d6685a41
2 changed files with 2 additions and 2 deletions

View file

@ -96,7 +96,7 @@ export default function (server) {
path: '/api/index-patterns',
method: 'POST',
handler: function (req, reply) {
if (_.isEmpty(req.payload)) { reply(Boom.badRequest('Payload required')); }
if (_.isEmpty(req.payload)) { return reply(Boom.badRequest('Payload required')); }
const client = server.plugins.elasticsearch.client;
const indexPattern = _.cloneDeep(req.payload);

View file

@ -27,7 +27,7 @@ define(function (require) {
bdd.describe('POST index-patterns', function postIndexPatterns() {
bdd.it('missing payload should return 400', function missingPayload() {
bdd.it('should return 400 for a missing payload', function missingPayload() {
return request.post('/index-patterns')
.send({})
.expect(400);