From 2087812776b0fecd21251d5f43bb615020a956d3 Mon Sep 17 00:00:00 2001 From: FrankHassanabad Date: Mon, 11 Jan 2021 13:11:50 -0700 Subject: [PATCH] Change DELETE to POST for _bulk_delete to avoid incompatibility issues --- .../detections/containers/detection_engine/rules/api.test.ts | 2 +- .../public/detections/containers/detection_engine/rules/api.ts | 2 +- .../server/lib/detection_engine/scripts/delete_bulk.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts index e94cc8845c5a5..fce9974b458c5 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts @@ -377,7 +377,7 @@ describe('Detections Rules API', () => { await deleteRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'] }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_bulk_delete', { body: '[{"id":"mySuperRuleId"},{"id":"mySuperRuleId_II"}]', - method: 'DELETE', + method: 'POST', }); }); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts index a5dddd6d9afd3..da33b7841c7a9 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts @@ -205,7 +205,7 @@ export const enableRules = async ({ ids, enabled }: EnableRulesProps): Promise => KibanaServices.get().http.fetch(`${DETECTION_ENGINE_RULES_URL}/_bulk_delete`, { - method: 'DELETE', + method: 'POST', body: JSON.stringify(ids.map((id) => ({ id }))), }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/delete_bulk.sh b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/delete_bulk.sh index 8f540e14ecdf1..6264a8e017ce3 100755 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/delete_bulk.sh +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/delete_bulk.sh @@ -17,6 +17,6 @@ curl -s -k \ -H 'Content-Type: application/json' \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X DELETE ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_delete \ + -X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_bulk_delete \ -d @${RULES} \ | jq .;