From e1bb5f58c4da2bc66aa86826168397547eb36ec5 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Wed, 6 Jan 2016 15:59:07 -0500 Subject: [PATCH] return 204 for successful POST an use JSON for all response payloads --- .../server/routes/api/ingest/register_delete.js | 2 +- .../kibana/server/routes/api/ingest/register_post.js | 2 +- test/unit/api/ingest/_del.js | 2 +- test/unit/api/ingest/_post.js | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/kibana/server/routes/api/ingest/register_delete.js b/src/plugins/kibana/server/routes/api/ingest/register_delete.js index 8691efae8732..44dafba1a0d1 100644 --- a/src/plugins/kibana/server/routes/api/ingest/register_delete.js +++ b/src/plugins/kibana/server/routes/api/ingest/register_delete.js @@ -24,7 +24,7 @@ module.exports = function registerDelete(server) { }) ]) .then(function (pattern) { - reply('success'); + reply({success: true}); }, function (error) { reply(handleESError(error)); }); diff --git a/src/plugins/kibana/server/routes/api/ingest/register_post.js b/src/plugins/kibana/server/routes/api/ingest/register_post.js index 8a6fc84f5a32..4ec9fd6480ef 100644 --- a/src/plugins/kibana/server/routes/api/ingest/register_post.js +++ b/src/plugins/kibana/server/routes/api/ingest/register_post.js @@ -91,7 +91,7 @@ module.exports = function registerPost(server) { }); }) .then(() => { - reply('success').code(201); + reply().code(204); }) .catch(function (error) { reply(handleESError(error)); diff --git a/test/unit/api/ingest/_del.js b/test/unit/api/ingest/_del.js index 253e3ff90a84..f834d39fe994 100644 --- a/test/unit/api/ingest/_del.js +++ b/test/unit/api/ingest/_del.js @@ -14,7 +14,7 @@ define(function (require) { .then(function () { return request.post('/kibana/ingest') .send(createTestData()) - .expect(201); + .expect(204); }); }); diff --git a/test/unit/api/ingest/_post.js b/test/unit/api/ingest/_post.js index f0753de978f9..8a247e8002be 100644 --- a/test/unit/api/ingest/_post.js +++ b/test/unit/api/ingest/_post.js @@ -38,16 +38,16 @@ define(function (require) { ]); }); - bdd.it('should return 201 when an ingest config is successfully created', function createIngestConfig() { + bdd.it('should return 204 when an ingest config is successfully created', function createIngestConfig() { return request.post('/kibana/ingest') .send(createTestData()) - .expect(201); + .expect(204); }); bdd.it('should create an index template if a fields array is included', function createTemplate() { return request.post('/kibana/ingest') .send(createTestData()) - .expect(201) + .expect(204) .then(function () { return scenarioManager.client.indices.getTemplate({name: 'kibana-logstash-*'}); }); @@ -56,7 +56,7 @@ define(function (require) { bdd.it('should provide defaults for field properties', function createTemplate() { return request.post('/kibana/ingest') .send(createTestData()) - .expect(201) + .expect(204) .then(function () { return scenarioManager.client.get({ index: '.kibana', @@ -82,7 +82,7 @@ define(function (require) { function createTemplate() { return request.post('/kibana/ingest') .send(createTestData()) - .expect(201) + .expect(204) .then(function () { return scenarioManager.client.indices.getTemplate({name: 'kibana-logstash-*'}) .then(function (template) { @@ -112,7 +112,7 @@ define(function (require) { bdd.it('should return 409 conflict when a pattern with the given ID already exists', function patternConflict() { return request.post('/kibana/ingest') .send(createTestData()) - .expect(201) + .expect(204) .then(function () { return request.post('/kibana/ingest') .send(createTestData())