From c7c7b8b52b999de8a59a49fb9196b6da3fd11bd0 Mon Sep 17 00:00:00 2001 From: Petar Partlov Date: Wed, 9 Nov 2022 18:20:48 +0100 Subject: [PATCH] Set message when building LegacyCustomWebhookMessage Signed-off-by: Petar Partlov --- .../org/opensearch/alerting/model/destination/Destination.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/model/destination/Destination.kt b/alerting/src/main/kotlin/org/opensearch/alerting/model/destination/Destination.kt index 043c4bcf1..4e7ce5205 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/model/destination/Destination.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/model/destination/Destination.kt @@ -260,7 +260,7 @@ data class Destination( } DestinationType.CUSTOM_WEBHOOK -> { destinationMessage = LegacyCustomWebhookMessage.Builder(name) - .withUrl(getLegacyCustomWebhookMessageURL(customWebhook)) + .withUrl(getLegacyCustomWebhookMessageURL(customWebhook, compiledMessage)) .withHeaderParams(customWebhook?.headerParams) .withMessage(compiledMessage).build() } @@ -296,7 +296,7 @@ data class Destination( return content } - private fun getLegacyCustomWebhookMessageURL(customWebhook: CustomWebhook?): String { + private fun getLegacyCustomWebhookMessageURL(customWebhook: CustomWebhook?, message: String): String { return LegacyCustomWebhookMessage.Builder(name) .withUrl(customWebhook?.url) .withScheme(customWebhook?.scheme) @@ -304,6 +304,7 @@ data class Destination( .withPort(customWebhook?.port) .withPath(customWebhook?.path) .withQueryParams(customWebhook?.queryParams) + .withMessage(message) .build().uri.toString() } }