diff --git a/src/main/kotlin/com/carbonara/core/delivery/SlackDeliveryWebhookController.kt b/src/main/kotlin/com/carbonara/core/delivery/SlackDeliveryWebhookController.kt index f22c8b1..d39d40b 100644 --- a/src/main/kotlin/com/carbonara/core/delivery/SlackDeliveryWebhookController.kt +++ b/src/main/kotlin/com/carbonara/core/delivery/SlackDeliveryWebhookController.kt @@ -3,7 +3,6 @@ package com.carbonara.core.delivery import com.carbonara.core.order.OrderService import mu.KotlinLogging import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @RestController @@ -13,10 +12,10 @@ class SlackDeliveryWebhookController( // Potential dos attack endpoint, introduce rate limiting - @PostMapping("/slack-delivery-status") - suspend fun handleSlackWebhook(@RequestParam("payload") payload: String) { + @PostMapping("/slack-delivery-status", "application/x-www-form-urlencoded") + suspend fun handleSlackWebhook(payload: SlackWebhookRequestBody) { log.info("--Start Slack--") - log.info(payload) + log.info(payload.payload) log.info("--End Slack--") } @@ -24,3 +23,7 @@ class SlackDeliveryWebhookController( private val log = KotlinLogging.logger {} } } + +data class SlackWebhookRequestBody( + val payload: String +)