From 3d90f66be83a1f68adc2e967ca9e974314e5996c Mon Sep 17 00:00:00 2001 From: shahzad31 Date: Mon, 12 Aug 2024 17:57:15 +0200 Subject: [PATCH] throw bad if both provided --- .../server/routes/monitor_cruds/delete_monitor.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugins/observability_solution/synthetics/server/routes/monitor_cruds/delete_monitor.ts b/x-pack/plugins/observability_solution/synthetics/server/routes/monitor_cruds/delete_monitor.ts index f74b20bf0120f..b7a1d0b2d48d8 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/routes/monitor_cruds/delete_monitor.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/routes/monitor_cruds/delete_monitor.ts @@ -56,6 +56,12 @@ export const deleteSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory< const { ids } = request.body || {}; const { id: queryId } = request.params; + if (ids && queryId) { + return response.badRequest({ + body: { message: 'id must be provided either via param or body.' }, + }); + } + const result: Array<{ id: string; deleted: boolean; error?: string }> = []; const idsToDelete = [...(ids ?? []), ...(queryId ? [queryId] : [])]; if (idsToDelete.length === 0) {