[6.7] Using POST instead of DELETE for bulk deletion of pipelines (#31023) (#31205)

Backports the following commits to 6.7:
 - Using POST instead of DELETE for bulk deletion of pipelines  (#31023)
This commit is contained in:
Shaunak Kashyap 2019-02-14 14:58:35 -08:00 committed by GitHub
parent deae7357cf
commit 02c2d9cbb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View file

@ -80,14 +80,10 @@ export class PipelinesService {
* @return Promise { numSuccesses, numErrors }
*/
deletePipelines(pipelineIds) {
// $http.delete does not take the request body as the 2nd argument. Instead it expects the 2nd
// argument to be a request options object, one of which can be the request body (data). We also
// need to explicitly define the content type of the data.
const requestOpts = {
data: { pipelineIds },
headers: { 'Content-Type': 'application/json' }
const body = {
pipelineIds
};
return this.$http.delete(`${this.basePath}/pipelines`, requestOpts)
return this.$http.post(`${this.basePath}/pipelines/delete`, body)
.then(response => {
this.addToRecentlyDeleted(...pipelineIds);
return response.data.results;

View file

@ -37,8 +37,8 @@ export function registerDeleteRoute(server) {
const licensePreRouting = licensePreRoutingFactory(server);
server.route({
path: '/api/logstash/pipelines',
method: 'DELETE',
path: '/api/logstash/pipelines/delete',
method: 'POST',
handler: (request) => {
const callWithRequest = callWithRequestFactory(server, request);

View file

@ -30,8 +30,8 @@ export default function ({ getService }) {
it('should delete the specified pipelines', async () => {
await supertest
.delete(
'/api/logstash/pipelines'
.post(
'/api/logstash/pipelines/delete'
)
.set('kbn-xsrf', 'xxx')
.send({