From 60af873ee0471f470352c8869ff04298e396e1b0 Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Mon, 31 Jul 2023 18:31:15 +0800 Subject: [PATCH] Fix core XcontentFactory refactor (#732) Signed-off-by: Hailong Cui (cherry picked from commit 216dfcb95eff41ab04785980e89c0bd260b34042) --- .../notifications/core/client/DestinationHttpClient.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt index aab211fb..f481a3b1 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt @@ -20,9 +20,9 @@ import org.apache.http.impl.client.DefaultHttpRequestRetryHandler import org.apache.http.impl.client.HttpClientBuilder import org.apache.http.impl.conn.PoolingHttpClientConnectionManager import org.apache.http.util.EntityUtils -import org.opensearch.common.xcontent.XContentFactory import org.opensearch.common.xcontent.XContentType import org.opensearch.core.rest.RestStatus +import org.opensearch.core.xcontent.MediaTypeRegistry import org.opensearch.notifications.core.setting.PluginSettings import org.opensearch.notifications.core.utils.OpenForTesting import org.opensearch.notifications.core.utils.logger @@ -155,7 +155,7 @@ class DestinationHttpClient { } fun buildRequestBody(destination: WebhookDestination, message: MessageContent): String { - val builder = XContentFactory.contentBuilder(XContentType.JSON) + val builder = MediaTypeRegistry.contentBuilder(XContentType.JSON) val keyName = when (destination) { // Slack webhook request body has required "text" as key name https://api.slack.com/messaging/webhooks // Chime webhook request body has required "Content" as key name