From 34c0547a46700652397bcacaec7f3ab284c27f4e Mon Sep 17 00:00:00 2001 From: Petar Partlov Date: Thu, 1 Dec 2022 19:01:11 +0100 Subject: [PATCH] Set message when building LegacyCustomWebhookMessage (#670) Signed-off-by: Petar Partlov Signed-off-by: Petar Partlov (cherry picked from commit 9d9f588426b6df8a4a084866f65532baef9268e3) --- .../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() } }